I would like to make some changes to my EF4 edmx file without modifying the file itself, mainly so I don't loose all my changes if I regenerate the model from the database. I'm familiar with XSL and have seen references made to using it in conjunction with the edmx file. This sounds like a great solution, however I can't seem to find any...
Is it possible to create a dynamic query with Entity Framework. I Have 18 tables, Each of them has the same structures. How can I create a dynamic query to reuse the same query for each tables. I would like to have a generic query for Create Read Update Delete.
The read contains the same "Where" Clause.
Thanks for your help.
...
Hi!
I want to have an ObjectQuery that returns tracked entities (not static data), but I don't want it to load all the columns, I want some columns to load as null, I don't want to use select, since this will return an IEnumerable of the values, not tracked objects.
Is there a way to do it?
If yes, how do I then complete reloading tho...
I am using EF 4.0 and am generating my Entity Model (.edmx) file from my database. I have several foreign key constraints for Cascade OnDelete, however, these are not getting set on my associations in my entity model. I click on the association and it shows End1 OnDelete: None.
When I check the Delete rules in my SQL Server 2008 databa...
Hi folks
Im new to MVC, EF4 and Linq, so forgive my ignorance
If im using a Linq Query to return data to pop into a viewmodel, I can include tables with a relation and get to the data without relying on lazy loading.
However I have a problem eager loading data that isnt in a directly relatede table. e.g I have fixtures that relate to ...
I am trying to write some unit tests (more integration tests actually) to hit a live IIS server hosting my WCF service. Whenever I run a test though, if one of my Assert statements fails on the client side, my WCF service seems to lock up- and I have to do an iisreset to get things back online.
For example, I have in a test method 3 ca...
I am trying to establish a good practice for working with secondary keys when using self tracking entities and entity framework 4, but there seems to be a lot of pitfalls.
Lets say I have an Alarm entity, that can have ConfirmingUser navigational property to a User. The User has an Id as primary key and a "Login" as secondary key.
At so...
We're building a game, so that may help to put the objects into context better.
I have a situation where I have a structure kind of like this..
- Template
- Data(ICollection<Statistics>)
- Character: Template
- Data (ICollection<Statistics>)
To elaborate...
Let us assume that every character has a property "Health". Now, th...
I have an entity that has a property called YearsAvailible, this is a comma separated list of financial years e.g. 05,09,10 I have an API that is passes a string[] of year names and I need to search for all of the entity that have a financial year that is in the passed array.
The best I can come up with is this:
var hash = new Hashtabl...
We have update store procedure that we have to use that have the parameter as _ModifiedBy.
EF create mapping and add p letter to the parameter name like p_ModifiedBy, that I can not change.
When the program call to the store procedure it fails with no _ModifiedBy parameter was supplied.
Changing the parameter name to start with letter fi...
I have 3 tables -
User (Id, Name)
Roles (Id, Name)
UserRoles (UserId, RoleId)
I think they are self explanatory. How do I update an entry (UserId and RoleId) in UserRoles?
context.User.Roles gives me the list of roles but how do I update them?
Thank you.
...
I've built a WCF Service in .NET 4.0 that basically just does standard CRUD to a couple of tables on a MS SQL Server 2005 database. I'm using an ADO .NET Entity Data class to map to the database tables. So far, this has been really simple. I've just pulled the tables onto the design surface and let the tool do the work for me.
Here's...
I would like to know, in a database first approach, if it is possible to automatically strip prefixes from table names.
For example table name is:
Core_Customers
I would like that to be just Customers.
Or is this only possible by editing all the class names in the edmx model?
...
I have a large table that I want to map to a few entities.
Say the table looks like this: Thing(ThingId, Property1...Property20)
Now I have my entities:
public abstract class ThingBase
{
public int ThingId { get; set; }
public string Property1 { get; set; }
public string Property2 { get; set; }
}
public class ThingSummary...
Hi,
I had a look at EF 4 (Entity Framework) from MS (notice I am a beginner :-).
I understand its use for separation of Layer Logic as DAL.
In EF 4 I see it is possible to create code for query the Data Base, query are stored in DAL.
My questions is what could be the benefit of using SPROC with EF 4?
To me calling SPROC from the EF 4 ...
I have implement such query using Entity SQL. How i may perform inner join with related entity
how may i do this using Entity SQL or Linq to Entity
...
I cant find any samples how to write Inner join with ObjectQuery using Entity SQL in EF 4.0
May be some on may help?
...
I'm trying to create fake context accodring to http://blogs.msdn.com/b/adonet/archive/2009/12/17/walkthrough-test-driven-development-with-the-entity-framework-4-0.aspx
As i can see there is an interface which exposes methods which returns IObjectSet<...>, but T4 templates generates methods which returns ObjectSet<...> and there is no ge...
I'm using code-first pattern for database layer.
I have two POCO classes:
public class Order
{
[Key]
public int OrderId { get; set; }
public virtual ICollection<Item> Items { get; set; }
// other fields
}
and
public class Item
{
[Key]
public int ItemId { get; set; }
public virtual ICollection<Order> Order...
Hi there
I'm working on a distributed app with a server and a client, where the server exposes services via WCF. The server uses the Entity Framework, and its various methods return EntityObjects.
In the client, I have no references to the server. So in the client, the classes are wholly generated proxies.
I have a delete method in th...