Imagine you want to create an application which manages product stocks using Northwind but which doesn’t create products. For this, we want two Entitysets: Product and Supplier with Supplier on read only. We also want a read only product CategoryName property. How to do this with the least possible amount...
As you have probably seen with Roger comment and his blog post about this , my post "AsEnumerable: not only to use unsupported methods" wasn't very clear. So I will try to clarify it. In my old post Entity Framework Include with Func" , Niraj posted an interesting comment. In fact...
AsEnumerable extension method allow us to use an IEnumerable<T> instead of an IQueryable<T>. This allows, for example, to call an unsupported method by LINQ To Entities in a LINQ To Entities request. However, this method can have another interest. Imagine that you want to get Northwind orders...
I defined an Include with Func . Cool. But what about Include("Products.Order_Details")? Indeed my Include can only take one relationship level. So I change my code like this: public static class ObjectQueryExtension { public static ObjectQuery <T> Include<T>( this ObjectQuery <T>...
In Northwind DB, if you want to load categories with products, you will use Include method: context.Categories.Include( "Products" ) But what I really find bad is the fact that Products is a string. When we use LINQ, we can't understand it. So I define an extension method: public static...
Daniel Simmons updated EF FAQ . What are the changes? (from Daniel 's post ). Updated: 1.2 Where else should I go to learn more about the EF? New: 7.7 Why does deleting an entity from my context not delete all related entities when I have cascade delete defined in the model? New: 18.5 Why doesn’t...
I see that too few developpers really know how to use ApplyPropertyChanges ObjectContext's method. So I will enumerate some importants points. ApplyPropertyChanges is used when you have an entity detached of its context and you would like to save the modifications on it. You have two choices. You...
I do an EntityCloner which can Clone an entity single or all the graph from one entity. To clone an entity, I use reflection but the problem of Reflection is it’s far. The way to Clone a product is always the same. So I generate a Delegate on the fly during first call and I always use it. For this, I...
Until last version, EDM didn't allow to choose EntitySets visibility (so public) neither EntityTypes and limited the EntityType properties get and set to public or private. Since VS 2008 SP1 Beta, we can choose EntitySets visibility between private, protected, internal and public. It's the same...
Daniel Simmons updated EF FAQ . What are the changes? (from Daniel 's post ) " · Some minor formatting edits. · Updated: 1.2 Where else should I go to learn more about the EF? · New: 9.3 What does the SelectValue builder method do? What is “select value” in Entity SQL? · New: 18.4 How many Includes...