Microsoft TechDays 2010 Portugal – Entity Framework 4.0 Evolution and Future
So another session that I did at Microsoft TechDays 2010 Portugal was around Microsoft Entity Framework 4.0 Evolution and features we can expect in the future. And being a 400 Level session I tried to do it as much sample based and interactive as possible, by asking the attendees what were their normal pains when using Entity Framework or any other ORM framework that they were working on, and show a sample of how to do that. Unfortunately there wasn’t as much interaction as I was expecting, but still we could see the most recent evolutions on this technology.
Here’s a summary of what this session was:
- Slight Introduction to Entity Framework and how that is part of the Data Platform Group, and what other elements are also at that group, and those are:
- Visual Studio Integration
- Quadrant
- Entity Framework
- WCF Data Services
- OData
- ADO.NET
- “M” / EDM
- SQL Server
- SQL Azure
- SQL Modeling Services
- …
- New features
- Model-First Development
- We are now able to achieve an approach where we do the EF Model first and after that we generate the database based on that, or only map the Storage Model into it.
- Automatic Pluralization
- The model now has the capability of instead of making the EntitySets named something like the name of the entity and adding Set to the name (ex. Person, PersonSet), we now have the option to pluralize that and it will do that automatically for us (ex. Person, People)
- Foreign Keys in models
- Previously we didn’t had the foreign keys of the navigation properties on our models, now we do.
- POCO Support
- Lazy Loading
- Now lazy loading is on by default and really works without having to use Include like it was previously
- T4 Code Generation
- A complete set of T4 templates we can use and customize to define how we want our code files to be generated
- Template Customization (same as before)
- IObjectSet
- Now we have an interface that is IObjectSet that is the basis of out EntitySet, and what this allows us to do, is create our our POCO classes that are Self-tracking
- Virtual SaveChanges method
- In this version we have SaveChanges marked as virtual, and so we can override that and place our own code in there.
- ObjectStateManager object
- Manages the state of our objects
- Self-tracking Entities
- Capability of doing some entities that are responsible for their own change management, and also aware of those changes
- SQL Generation Improvements
- Huge leap in terms of performance, since a lot was done in order to get the best possible sql code generated based on the Linq query. Examples like the usage of Like clause in SQL when we in Linq use the Contains method, instead of the previously used CharIndex.
- More Linq operator support
- Contains
- DefaultIfEmpty
- Single, SingleOrDefault (in top projection)
- ExecuteStoreQuery and Translate
- Linq Extensibility
- A Namespace called Microsoft.Data.Entity.Design.Extensibility with a set of objects that will allow us to extend the way that the ADO.NET Data Model Tools work.
- http://msdn.microsoft.com/en-us/library/microsoft.data.entity.design.extensibility.aspx
- ExecuteStoreQuery
- Enables us to pass a sql query directly to the Store of our model
- http://msdn.microsoft.com/en-us/library/ee358769.aspx
- ExecuteStoreCommand
- Enabled us to pass sql commands directly to the Store of our model
- http://msdn.microsoft.com/en-us/library/system.data.objects.objectcontext.executestorecommand.aspx
- Stored Procedures Import improvements
- Capability of having Store Procedures imported to the model as Methods, as well as having also functions as part of the model methods
- Model defined functions (same as above)
- WPF designer integration
- New Designer in VS2010 is done in WPF
- Code-only development (Only at EF Features CTP3)
- Possibility of having all the EF model being done in code without using edmx, csdl, ssdl or msl files. All of this will be described in code.
- Model-First Development
- Possible Routes using Entity Framework
- Start with the database
- Database-first approach
- Start with the Model
- Model-first approach
- Start with .net classes
- Code-first approach
- Start with the database
You can find this presentation here and on SlideShare:
TechDays 2010 Portugal - Entity Framework 4.0 Evolution and Future - 16x9
View more presentations from Nuno.Godinho.
I would enjoy very much to ear your thoughts about this presentation.