dotnet For ISVs wanting to update legacy applications or for new green field development, ADO.NET Entity Framework 4 has become a time saving, cost effective way to build out your data tier of your application. Entity Data Model (EDM) provides a uniform way for you to work with data by specifying the data structure of a client application through business logic, namely entities and relationships.

Entity Framework 4 now supports:

  • POCO Support: You can now define entities without requiring base classes or data persistence attributes.
  • Lazy Loading Support: You can now load sub-objects of a model on demand instead of loading them up front.
  • N-Tier Support and Self-Tracking Entities: Handle scenarios where entities flow across tiers or stateless web calls.
  • Better SQL Generation and SPROC support: EF4 executes better SQL, and includes better integration with SPROCs
  • Automatic Pluralization Support: EF4 includes automatic pluralization support of tables (e.g. Categories->Category).
  • Improved Testability: EF4’s object context can now be more easily faked using interfaces.
  • Improved LINQ Operator Support: EF4 now offers full support for LINQ operators

Your Choice: Database-First, Model-first, and Code-first

Entity Framework 4 and Visual Studio 2010 supports your choice of development styles.

  • Database-first is where you construct your model layer on a design surface from an existing database.
  • Model-first is where you create a conceptual 'model first' and then deriving a storage model, database and mappings from that.
  • Code-first is where you first define your model layer using the design surface, and can then use it to generate database schema from it.

If you want to do model-first development, EF4 offers a Generate Database Wizard to create the database and parts of the EDM (SSDL, MSL) from a conceptual model.

EF’s “code first development” support is currently enabled with a separate download that runs on top of the core EF built-into .NET 4.  CTP4 of this “code-first” library shipped recently and can be downloaded here.

About ADO.NET Entity Framework

The ADO.NET Entity Framework enables developers to create data access applications by programming against a conceptual application model instead of programming directly against a relational storage schema. The goal is to decrease the amount of code and maintenance required for data-oriented applications. Entity Framework applications provide the following benefits:

  • Applications can work in terms of a more application-centric conceptual model, including types with inheritance, complex members, and relationships.
  • Applications are freed from hard-coded dependencies on a particular data engine or storage schema.
  • Mappings between the conceptual model and the storage-specific schema can change without changing the application code.
  • Developers can work with a consistent application object model that can be mapped to various storage schemas, possibly implemented in different database management systems.
  • Multiple conceptual models can be mapped to a single storage schema.
  • Language-integrated query (LINQ) support provides compile-time syntax validation for queries against a conceptual model.

Getting Started with Entity Framework 4

See Getting Started (Entity Framework) on MSDN.

Kathleen Richards of Redmond Magazine had penned an article providing an overview to Entity Framework 4 entitled, Cover Story: Get Ready for the Entity Framework.

Database-first. The Quickstart tutorial demonstrates how to build an Entity Framework application from an existing database.

Model-first. See Model First for step-by-step tutorial on how to generate a database from a model.

Code-first. To see how to use Entity Framework using code-first with an existing database, see Scott Guthrie’s posts:

 

Bruce D. Kyle
ISV Architect Evangelist | Microsoft Corporation

cid:image010.png@01C9DEED.1FDB2200 cid:image011.png@01C9DEED.1FDB2200 cid:image012.gif@01C9DEED.1FDB2200 channel9