One thing lacking from EF 4 is code first. They showed off a new CTP for Entity Framework that includes these features.
New API surface for simplifying EF: DbContext, DbSet<T>, more. DbContext gives a vastly simplified view at an EntityContext.
Code first can created a database automatically.
Of course, makes all sorts of assumptions based on conventions.
- Pluralization convention
- Infers references between tables into keys and foreign keys
- EdmMetaData table contains snapshot that is kept to keep code/database in sync.
- Attributes can be used to override conventions (e.g., StringLengthAttribute overrides the default length of 4000 for strings). In Microsoft.Data.Entity.Ctp System.ComponentModel.DataAnnotations.
- DatabaseInitializer can force your code to be in sync. Automatically? Sounds dangerous, but they give you many options. Pretty cool, really.
- Conventions for inferring many-to-many relationships.
They added an OData service on top. OData is really cool. May change my itinerary to go to an OData session.
- Enum support!
- Alternate keys
- TVF support!
- Migrations and deployment
- Perf & scalability
- Designer improvements (multiple models!)
- Better SQL generation
Available now in a CTP, 5th CTP out in another month. 2011 Q1 will be the first full release. Terrific that Microsoft is delivering on their out-of-band enhancements.