Expert Texture Home Contact me About Subscribe Digipede Connect on LinkedIn rwandering on Twitter rwandering on FriendFeed

rwandering.net

The blogged wandering of Robert W. Anderson

New EF Features #PDC10

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.
  • StoreIgnore
  • 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.

Other things:

  • Enum support!
  • Spatial
  • 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.

Tags: , ,

From PDC2009 Day 1: Entity Framework 4

Lots of improvements to EF for 4.0:

  • Model-first development.
  • Lazy loading through relationships (i.e., no longer have to call Load)
  • POCO (i.e., define your own data classes against a model).
  • POCO only (i.e., define the model fully in code).
  • Code Generation options using the new T4 facility of VS 2010.
  • Testability improvements through IObjectSet
  • Can override SaveChanges
  • Better disconnected workflow (both by writing a little code and a no-code option that uses a different code generator).
  • Much better SQL (more compact, more efficient)
  • Execute arbitrary SQL
  • Easier Stored Procedures
  • Functions (a little strange how this was implemented, but now they are available).
  • Foreign Keys in the entities (no more manual interpretation of the Reference!)
  • Better Binding for forms apps and WPF

Pandelis, what do you think?

Tags: , , ,