Disconnected Entities: Before we see how to perform CRUD operation on disconnected entity graph, let's see how to associate disconnected entity graph with the new context instance. There are two things we need to do when we get a disconnected entity…
Code First development with Entity Framework: Entity Framework supports three different development approaches to use entity framework in your application. Code First Model First Database first Code First: In the Code First approach, you avoid workin…
Lazy Loading: One of the important functions of Entity Framework is lazy loading. Lazy loading means delaying the loading of related data, until you specifically request for it. For example, Student class contains StudentAddress as a complex property…
Eager Loading: Eager loading is the process whereby a query for one type of entity also loads related entities as part of the query. Eager loading is achieved using the Include() method. In the following example, it gets all the students from the dat…
Enum in Entity Framework: You can now have an Enum in Entity Framework 5.0 onwards. EF 5 should target .NET framework 4.5 in order to use Enum. Enum can be created for the following data types: Int16 Int32 Int64 Byte SByte You can create and use an E…
Stored Procedure in Entity Framework: Entity Framework has the ability to automatically build native commands for the database based on your LINQ to Entities or Entity SQL queries, as well as, build the commands for inserting, updating, or deleting d…
Concurrency in Entity Framework: Entity Framework supports Optimistic Concurrency by default. In the optimistic concurrency, EF saves the entity to the database, assuming that the same data has not changed since the entity was loaded. If it determine…
Update Entity Graph using DbContext: Updating an entity graph in disconnected scenario is a complex task. It is easy to add a new entity graph in disconnected mode, but to update an entity graph needs careful design consideration. The problem in upda…
Change Tracking in Entity Framework: Here, you will learn how entity framework tracks changes on entities during its life time. Entity framework supports automatic change tracking of the loaded entities during the life time of the context. DbChangeTr…
Querying with EDM: We have created EDM, DbContext, and entity classes in the previous sections. Here, you will learn the different types of queries an entity framework supports, which is in turn converted into SQL query for the underlaying database.…