Multiple Result Sets from database in Entity Framework

Stored Procedures with Multiple Result Sets Sometimes when using stored procedures you will need to return more than one result set. This scenario is commonly used to reduce the number of database round trips required to compose a single screen. Prior to EF5, Entity Framework would allow the stored procedure to be called but would only […]

Read More

How can I get Id of inserted entity in Entity framework?

It is pretty easy. If you are using DB generated Ids (like IDENTITY in MS SQL) you just need to add entity to ObjectSet and SaveChanges on related ObjectContext. Id will be automatically filled for you: using (var context = new MyContext()) { context.MyEntities.AddObject(myNewObject); context.SaveChanges(); int id = myNewObject.Id; // Yes it’s here } Entity […]

Read More

What is POCO in Entity Framework?

POCOS(Plain old CLR objects) are simply entities of your Domain.Normally when we use entity framework the entities are generated automatically for you.This is great but unfortunately these entities are interspersed with database access functionality which is clearly against the SOC(Separation of concern).POCOS are simple entities without any data access functionality but still gives the capabilities […]

Read More