The best part of using Entity Data Model designer is having the facility to use LINQ with the objectcontext.
Now consider you have the object-layer code created as follows-
To find the list of products in the database the code should be
The inside of a computer is as dumb as hell but it goes like mad!
~Richard Feynman
Now consider you have the object-layer code created as follows-
////// No Metadata Documentation available. /// public partial class InventoryEntities : ObjectContext { //autogenerated code ////// No Metadata Documentation available. /// public ObjectSetProducts { get { if ((_Products == null)) { _Products = base.CreateObjectSet ("Products"); } return _Products ; } } private ObjectSet _Products; }
To find the list of products in the database the code should be
InventoryEntities inventory = new InventoryEntities (); long cnt = inventory.Products.Execute(MergeOption.AppendOnly).LongCount();
The inside of a computer is as dumb as hell but it goes like mad!
~Richard Feynman