Hooked on LINQ

Hooked on LINQ - Developers' Wiki
for .NET Language Integrated Query

Quick Search


Edit

Entity Framework Essentials



Query option staircase, each layer up has a (small) performance hit

LINQ to Entities
Object Services
EntityClient
ADO.NET
Direct Provider


Object Services - Provides object serialization
- Queries are written in either EntitySQL or LINQ to Entities
- Identity Map
- Change Tracking
- Unit of Work (will persist in a transaction)


 
using (var context = AdventureWorksModel.AdventureWorksContext())
{
    var customers = (from customer in context.Customer
                     where customer.EmailAddress.Length > 20
                     select customer).ToList();
}
 



- Refreshing models : from designer you can update the models from the database. If columns are added, deleted or changed, you can update the model from the current DB connection....


- in V2 there will be less attributes on model entity classes describing how persistance will take place.


- Object services allows you to order and use various extension methods that will impact the LINQ query. E.g. To order by a specified user field name, we can use the OrderBy extension on the IQueryable Entity Framework implementation.


 
using (var context = AdventureWorksModel.AdventureWorksContext())
{
    // note: "it" refers to the current entity! C# had "this", VB had "me", entity framework has "it"! This allows specifying a user input string in this case
    var customers = (from customer in context.Customer.OrderBy("it.FirstName") 
                     where customer.EmailAddress.Length > 20
                     select customer).ToList();
}
 



- Lay loading will occur as long as you specify the sub-tree in a where clause, and you can turn it ALL on in the designer. More info to come in the RTM version.

- Cascading delete options supported in XML at the moment and may be surrported in the designer.

If you would like to comment on this page, click on the Discuss button located on the top-right of each page. Feel free to edit any mistakes or ommissions you find. If you have an objection or find in-appropriate content then contact the administrator. This website is not affiliated with Microsoft®, all content and opinions are those of the specific author and some advice, solutions and article may contain un-intentional errors - please use care. Powered by ScrewTurn Wiki version 2.0.15. Some of the icons created by FamFamFam.