Entity Framework Database First

The Entity Framework was originally designed to make working with existing databases easier. As a result, the database first workflow is the most polished version of the three options. Given an existing database, the Entity Framework can analyze it, provide you with options for importing partially or all of the structure, and then create the model automatically. The underlying objects are automatically generated as well. All that developer really needs to worry about is creating the application itself; the database access is pretty much handled by the Entity Framework. In general, this feature of the Entity Framework works incredibly well and is quite fast

The most significant advantage of the database first workflow (besides being incredibly fast) is its consistency. Having a means of producing consistent model is important in a large team setup. Team members can work on various parts of the database and the resulting model will still go well together because it was produced in a consistent manner in the first place.

Be aware, this is also the least flexible method of creating the underlying objects used by the .NET Framework as part of your application. The development team gains the least knowledge of precisely how things work. In fact, the objects begin as a black box that could cause you problems later if the Entity Framework encounters some oddity in the original database. To make changes to the underlying objects, you also have to rely on working with extensions, rather than modify the code directly, because the automation overwrites any changes you make. This leads to problems of figuring out just which file to look in for changes.

C# and Entity Framework Releases

Recently, Rowan Miller, the Program Manager of ADO.NET at Microsoft, pointed out that they have released EF 4.1 Release Candidate (RC), EF Power Tools CTP1, EF June 2011 CTP, EF 4.1 Language Packs, EF 4.1 Update 1 and Code First Migrations August 2011 CTP. The vast majority of the new classes are written in both Visual Basic and C#.

So what will be shipped?

There are two logical parts to the Entity Framework, the core components that ship inside the .NET Framework and Visual Studio, and the ‘out of band’ components that they can update on a much more frequent schedule. The Microsoft ADO.NET team is currently looking at how they can update the core components more frequently as well. The ‘EF June 2011 CTP’ was their first attempt at shipping the core components more often, but are not technically able quite yet.

Some core components include Core EF Runtime and EF Designer. Out of band components include the DbContext API & Code First, T4 Templates for using DbContext API with Model First & Database First, EF Power Tools, and Code First Migrations

Where will be shipped?

As mentioned above, the core components will remain part of the .NET Framework and Visual Studio. The out of band components will be primarily available via NuGet and Visual Studio Gallery.

The DbContext API & Code First will continue to be available as the EntityFramework NuGet package. They no longer plan to provide a stand-alone installer for these components. The NuGet package provides a way to register a GAC or distribute the EntityFramework assembly. T4 Templates for DbContext API will become available on Visual Studio Gallery. In the past they have distributed other T4 templates, such as our POCO templates, by using this mechanism. EF Power Tools will continue to be available on Visual Studio Gallery, and Code First Migrations will continue to be available via NuGet. It’s likely that Microsoft will also release using another mechanism to support team build and deployment scenarios, but currently are still working through the logistics.

NuGet will eventually have built-in support for pre-release versions of packages, but in the meantime will introduce a .Preview version of each package. For example, the EntityFramework package will be the latest fully supported runtime, and EntityFramework.Preview will be the latest preview.

Version Numbers

The version numbers of the core components will be governed by the .NET Framework & Visual Studio release that they are part of. Once a component has had an RTM release (i.e. reached version 1.0.0) all subsequent previews will use the target final release number, along with an ‘alpha’, ‘beta’, etc. special version. For example, they will release EntityFramework.Preview package with a version number of ‘4.2.0beta1’ before releasing EntityFramework with a version number of 4.2.0.

Copyright © All Rights Reserved - C# Learners