This is one of a series of posts on my preparations for sessions on Azure and ORMs at Software Architect 2009.
[Last updated 23rd Sept 2009]
This is my attempt to pull together all (ok – most) of the improvements in Entity Framework 4.0 and aggregate useful resources against each. It is very much work in progress – but is hopefully already fairly helpful.
Some of the links are to early posts which came out pre VS2010 Beta 1. These should be treated with caution as a lot changed since they were written – but they often start with a good introduction to the topic and hence I felt they were worth including.
- Updated Entity Framework Documentation for Beta1: MSDN Documentation (far from complete)
- Announcing: Entity Framework Feature CTP 1: After VS2010 Beta 1 shipped, the EF team added 3 new features in a CTP1 just for Entity Framework. The documentation comes as walkthroughs
Overview blog posts
- Entity Framework Transparent Design Blog http://blogs.msdn.com/efdesign
- ADO.NET Team blog http://blogs.msdn.com/adonet
- Daniel Simmons http://blogs.msdn.com/dsimmons
- Diego Vega’s blog http://blogs.msdn.com/diego
- Alex’s blog http://blogs.msdn.com/alexj
- Julie Lerman, author of Programming Entity Framework http://thedatafarm.com/blog
- Check out EF4 posts http://thedatafarm.com/blog/tags/ef4/
- Roger Jennings, author of ADO.NET 3.5 with LINQ and the Entity Framework
- Entity Framework post aggregation
- Dan Rigsby http://www.danrigsby.com/blog
- Gunnar http://weblogs.asp.net/gunnarpeipman/archive/tags/Entity+Framework/default.aspx
- Tony http://blog.tonysneed.com/
Screencasts and Podcasts
- Julie Lerman Tips and Tricks – includes some EF4 insights http://www.oreillynet.com/pub/e/1412 (60mins)
- 10-4 Episode 15: Model-First Development with the Entity Framework 4.0
- .NET Rocks with Daniel Simmons May 22nd 2009.
- A series of Entity Framework Tips. Some are EF 4.0 specific
Improvements to the Tools/Designer
- Now used the T4 template engine for code generation
- You can configure the ADO.NET Entity Data Model Designer to use text templates to generate customized object layer code. For more information, see How to: Customize Object Layer Code Generation.
- Customizing T4 Templates
- Feature CTP Walkthrough: POCO Templates for Entity Framework
- Sneak Peek – Using Code Generation Templates with the Entity Framework 4.0
- Customizing EDM Code Gen in EF4
- Model-First Development is now possible
- The Create Database Wizard enables you to do conceptual modelling first, and then create a database that supports the model. For more information, see How to: Generate a Database from a Conceptual Model.
- Sneak Preview: Model First in the Entity Framework 4.0
- Model First (Sept 2008)
- Entity Framework 4.0: Generating SQL script from model
- Automatic Pluralization/Singularization is now added including customisation
- The Entity Data Model Wizard and the Update Model Wizard provide the option of using singular or plural forms of Entity, EntitySet, and NavigationProperty names to make application code more readable. For more information, see Choose Your Database Objects Dialog Box (Entity Data Model Wizard) and Choose Your Database Objects Dialog Box (Update Model Wizard).
- Sneak Preview – Pluralization in Entity Framework 4.0
- Entity Framework 4.0: Pluralization – deep look at customising
- The much improved EDM Wizard Pluralization in VS2010
- Pluralization (Dec 2008)
- The designer now surfaces Complex Type support
- The ADO.NET Entity Data Model Designer now supports complex types. For more information, see the following topics:
- Complex Types in the EDM Designer in EF4 and a look at updating complex types in code
- Stored procedure mapping is improved significantly
- Improved control over Entity deletion and search
- The Model Browser window of the ADO.NET Entity Data Model Designer enables you to delete objects from the storage model and to search the conceptual and storage models for a specified string. For more information, see Model Browser Window and How to: Delete Objects from the Storage Model.
- More Designer Improvements – Deleting Entities from the model and from the store schema
- EF4 – New Properties for Entity Properties?
- Making it easier in the designer to do EF Table Splitting – The Opposite of Entity Splitting
You can use your own custom data classes together with your data model without making any modifications to the data classes themselves. This means that you can use "plain old" CLR objects (POCO), such as existing domain objects, with your Entity Framework application. For more information, see Persistence Ignorant Objects (Entity Framework).
- No need to inherit from EntityObject
- No need to implement any EF interface
- No metadata attributes
- By-convention mapping between model and POCOs
- Any ICollection<T> for collections and object references for relationships
- Snapshot change detection
- POCO in Entity Framework : Part 1 – The Experience
- POCO in Entity Framework : Part 2 – Complex Types, Deferred Loading and Explicit Loading
- POCO in Entity Framework : Part 3 – Change Tracking with POCO
- Using Repository and Unit of Work patterns with Entity Framework 4.0
- Why not use POCO always?
- Sneak Preview: Persistence Ignorance and POCO in Entity Framework 4.0
And from the community:
- First look http://mosesofegypt.net/post/Entity-Framework-4-Persistence-Ignorance-First-Look.aspx
- Entity Framework 4.0: POCOs and table-per-type inheritance mapping
- Entity Framework 4.0: How to use POCOs
- Entity Framework 4.0 – How To POCO
In NET 4.0 Beta 1 we introduced Model-First which allowed you to begin by creating an entity data model, then use it to create an empty database and classes. The subsequent CTP introduced Code Only.
- Begin by writing your classes, use them to create the database. There are no metadata artifacts at runtime
- Code Only introduction before CTP 1.
- Code Only Enhancements details what to expect in the release after CTP 1.
Deferred Loading of Related Objects (aka Lazy Loading)
With deferred loading, also known as lazy loading, related objects are automatically loaded from the data source when you access a navigation property. For more information, see Shaping Query Results (Entity Framework).
Foreign Key associations
Foreign Keys are now surfaced.
- An FK property can define an association and be part of the entity at the same time
- Concurrency is now shared with the entity
- FKs, EntityReferences, EntityCollections are all kept in sync
- Overlapping composite keys are supported
- Foreign Keys in the Entity Framework
- Foreign Keys in the Conceptual and Object Models (Oct 2008)
- Enhanced support of LINQ query operators
- Single, SingleOrDefault (in top projection)
- Function Mapping
- EntityFunctions and SqlFunctions
- The EntityFunctions and SqlFunctions classes provide access to canonical and database functions from LINQ to Entities queries. The EdmFunctionAttribute allows a CLR method to serve as a proxy for a function defined in the conceptual model or storage model. For more information, see Calling Functions in LINQ to Entities Queries.
- Model Defined Functions (Jan 2009)
- EF4: Model-Defined Functions Level 1 & 2
- EDM and Store functions exposed in LINQ (Oct 2008)
- ExecuteStoreQuery and Translate
- Not forgetting better support for using Stored Procedures (see Tools section above)
- Important Entity Framework Query Improvements for .NET 4.0
- Improvements to the Generated SQL in .NET 4.0 Beta1
In Beta 1 we added an improved API for reporting changes: ChangeObjectState, ChangeRelationshipState, ApplyOriginalValues. In the CTP we added Self-tracking entities: serialize changes alongside current state in the object graph
- Feature CTP Walkthrough: Self Tracking Entities for Entity Framework
- Sneak Preview: N-Tier development with Entity Framework 4.0
- Self-Tracking Entities in the Entity Framework
- Entity Framework: Anti-Patterns To Avoid In N-Tier Applications
Danny Simmons explores some anti-patterns you should look out for when building n-tier applications with the Entity Framework.
- Entity Framework: N-Tier Application Patterns
This article examines n-tier patterns for success and some of the key APIs and issues specific to the Entity Framework. It also provides a sneak peak at features coming in the Microsoft .NET Framework 4 that should make n-tier development significantly easier.
- N-Tier Improvements for Entity Framework (Nov 2008)
Improving Testability of the Entity Framework
Unit testing EF v1 is tricky (Check out Julies post on this). Things get a lot better with EF 4.0 thanks to a combination of features:
- POCO – classes that do not depend on the EF can be easier to test
- Data Access Guidance and the Repository pattern – work in progress http://dataguidance.codeplex.com/
- New IObjectSet<T> interface makes it easier to fake an object
- Template based code generation – control the code gen
- LINQ to Entities improvements make LINQ to Entities and LINQ to Objects closer – which can simplify testing
- Sneak Preview: Entity Framework 4.0 Testability Improvements