BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Entity Framework Code-First CTP5

Entity Framework Code-First CTP5

This item in japanese

Earlier this month the ADO.NET team released CTP5 of their Entity Framework Code-First library.  The library is meant to provide a code-centric workflow for developers when working with data.  This is the last CTP Microsoft will release before the final release expected in Q1 of 2011.

Entity Framework Code-First CTP5 enables developers:

  • develop without having to open a designer
  • define a model objects by writing classes with no base class required
  • enable database persistence without explicitly configuring anything

Known Issues in CTP5

  • Table and Column Mapping in the Fluent API - quality improvements needed
  • Pluggable Conventions - early preview in CTP5, more testing needed
  • Validation Feature - only supported when using Code First

New Additions since CTP4

DbContext

  • T4 Templates for using DbContext/DbSet
  • Validation of objects on save
  • Change Tracker API
  • DbSet.Local exposes an ObservableCollection representing the local contents of the DbSet
  • Support for No-Tracking Queries via the AsNoTracking extension method on iQueryable<T>
  • DbContext Configuration
  • Raw SQL Query/Command
  • Improved Concurrency conflict resolution

Code First

  • Full data annotation support
  • Fluent API Improvements
    • Simplified table and column mapping
    • Ability to ignore classes and properties
  • Pluggable Conventions - an early release, work still yet to be done

Changes from CTP4

  • New Assembly Name - EntityFramework.dll
  • Better Code-First to existing database support
  • DbContext.ObjectContext has moved - get context via ((IObjectContextAdapter)myContext).ObjectContext
  • Excluding EdmMetadata Table
  • Class Changes
    • System.Data.Entity.Database.DbDatabase
    • System.Data.Entity.Database.DropCreateDatabaselfModelChanges
    • System.Data.Entity.Database.DropCreateDatabaseAlways
    • System.Data.Entity.Database.CreateDatabaselfNotExists
    • System.Data.Entity.Database.SqlConnectionFactory
    • System.Data.Entity.Database.SqlCeConnectionFactory

Developers like the ease of installing the library with NuGet in Visual Studio and the fact it can be used against data living in SQL Azure.  Since the release, Morteza Manavi has put together an excellent series of articles on inheritance mapping and entity association using CTP5.

Rate this Article

Adoption
Style

BT