Introduction of Beta 1 Version of Entity Framework 6

Introduction

The latest version of Entity Framework is now released. In this article I am describing the features of Entity Framework 6 in brief. When the Alpha 3 versionwas released Microsoft had been working hard on adding the remaining features to the EF6 runtime. So now the Entity Framework Beta 1 version is released. The new version of Entity Framework is being developed under an open-source license. One more important news you need to notice is that the EF6 and above will not be shipped as part of the .NET Framework. This has many advantages. It means that Entity Framework providers for EF5 and previous versions will not work with this latest version until they have been rebuilt. 

In that context, I am describing some important things that are useful for you.

Migration of EF6 Alpha 1-3

If you want to migrate EF6 then you need to recreate the migration. You need to recreate the migration that was created when the previous version of Entity Framework 5 was installed. This is necessary because some changes were made to the metadata stored in the code behind. If you want to recreate migrations then you need to download the latest migration created with EF5 or earlier. For this you need to delete the migration from the migration folder that was created with EF6 and then you go to Add-Migration to re-scaffold the changes.

Providers for EF6

There are the following providers that have been rebuilt for EF6:

  • Microsoft SQL Server provider
  • Microsoft SQL Server Compact Edition provider
  • Firebird provider

Installation of Beta 1

The EF6 Beta 1 version is available on the NuGet Gallery. You do not need to install the tooling if you want to work in the Code-First approach. If you want to install the tooling, it is available in the Microsoft Download Center that will work with Visual Studio 2012.

Changes in EF6

Some of the changes compared with Alpha 3 are:

  • Entity Framework Tooling

    The Entity Framework 6 now has the EF tooling. The EF tooling in this preview supports EF6 and enables easy shipment of out-of-band updates between releases of Visual Studio.
     
  • Migration of Code First

    Now developers do not need to work for mapping of generate and alter the Stored Procedures. There is support for generating and altering a SP with the Code First migration.
     
  • Nesting of Entity

    Now, inside of the class you now have the ability to nest the entity and complex types.
     
  • DbSet.AddRange and RemoveRange

    This provides a very easy way to remove and add multiple entities.

Entity Framework 6 New Features

The following are the new features introduced in EF6:

  • Code First Convention

    The code first convention helps you to write your own convention for remove the repetition of configuration. The new simple API is provided for petty conventions and more complex building blocks are also defined to allow you to author more complicated conventions.
     
  • Resiliency of Connection

    The connection resiliency provides the automatic recovery from transient connection failure.
     
  • Dependency Resolution

    The Dependency Resolution feature helps for supporting Service Locator patterns. This also has some functionality that can be used in the place of custom implementations.
     
  • Code-Based Configuration

    The code that was generally implemented in the configuration file is now be performed in it. It is a new option provided by EF6.
     
  • Multiple Contexts per Database

    This new feature provides the new facility for removing the limitation of one Code First model per database when it is used for migration or when the database is created automatically in the code first.
     
  • Enum, Spatial Support

    The core components that are used in the .NET Framework using NuGet Package are now moved and we have support of enum of spatial data types and the performance is also improved to use Enumerable.Contains in LINQ queries.
     
  • Relationship of DbContext and DbConnection

    You have now the facility to create a DbContext with a DbConnection that is already opened. It would be helpful in the scenario if the connection could be open when creating the context.
     
  • DbModelBuilder.Configuration.AddFromAssembly method

    It is a new method that was contributed by UnaiZorrilla. Now you have the facility to add all configuration classes that are defined in an assembly when you use configuration classes in the Code First Fluent API.
     
  • Custom Migration Operations

    There is a contribution from Iceclow that enables a custom migration operation.
     
  • Improved Transaction Support

    The latest version of Entity Framework uses this feature for updates and this feature also supports EF to provide a transactional external to the framework and a way to create transactions within the framework is also improved.
     
  • Improved Warm-up Time

    The warm-up time, or say view generation, is significantly improved especially for large models.     

What's the Next?

Now, you know that the Beta 1 version of the Entity Framework latest version of EF6 is released. So now Microsoft is planning to release the final version and the main focus is how to polish and complete these features. Microsoft has used everything, like fixing bugs, to make EF6 a great release. 

Summary

So far you read that the latest version of Entity Framework is released which is the Beta 1 version of EF6 and the changes made in the Alpha 3. The new features included in this Beta 1 version and Microsoft is also planning for the final release of EF6. So just read and get some information about the new EF6 Beta 1 version.

Up Next
    Ebook Download
    View all
    Learn
    View all