Entity Framework RRS feed

  • Question

  • What are the new features in Entity Framework 6.0??
    Tuesday, October 4, 2016 6:36 AM


  • Hi Sulekh,

    I would suggest that you could refer to Entity framework Version History. Here are the new features in Entity Framework 6.0.

    The following features work for models created with Code First or the EF Designer:

    • Async Query and Saveadds support for the task-based asynchronous patterns that were introduced in .NET 4.5.
    • Connection Resiliencyenables automatic recovery from transient connection failures.
    • Code-Based Configuration gives you the option of performing configuration – that was traditionally performed in a config file – in code.
    • Dependency Resolutionintroduces support for the Service Locator pattern and we've factored out some pieces of functionality that can be replaced with custom implementations.
    • Interception/SQL logging provides low-level building blocks for interception of EF operations with simple SQL logging built on top.
    • Testability improvements make it easier to create test doubles for DbContext and DbSet when  using a mocking framework or  writing your own test doubles.
    • DbContext can now be created with a DbConnection that is already opened which enables scenarios where it would be helpful if the connection could be open when creating the context (such as sharing a connection between components where you can not guarantee the state of the connection).
    • Improved Transaction Support provides support for a transaction external to the framework as well as improved ways of creating a transaction within the Framework.
    • Enums, Spatial and Better Performance on .NET 4.0 - By moving the core components that used to be in the .NET Framework into the EF NuGet package we are now able to offer enum support, spatial data types and the performance improvements from EF5 on .NET 4.0.
    • Improved performance of Enumerable.Contains in LINQ queries.
    • Improved warm up time (view generation), especially for large models. 
    • Pluggable Pluralization & Singularization Service.
    • Custom implementations of Equals or GetHashCode on entity classes are now supported.
    • DbSet.AddRange/RemoveRange provides an optimized way to add or remove multiple entities from a set.
    • DbChangeTracker.HasChanges provides an easy and efficient way to see if there are any pending changes to be saved to the database.
    • SqlCeFunctions provides a SQL Compact equivalent to the  SqlFunctions.

    The following features apply to Code First only:

    • Custom Code First Conventions allow write your own conventions to help avoid repetitive configuration. We provide a simple API for lightweight conventions as well as some more complex building blocks to allow you to author more complicated conventions.
    • Code First Mapping to Insert/Update/Delete Stored Procedures is now supported.
    • Idempotent migrations scripts allow you to generate a SQL script that can upgrade a database at any version up to the latest version.
    • Configurable Migrations History Table allows you to customize the definition of the migrations history table. This is particularly useful for database providers that require the appropriate data types etc. to be specified for the Migrations History table to work correctly.
    • Multiple Contexts per Database removes the previous limitation of one Code First model per database when using Migrations or when Code First automatically created the database for you.
    • DbModelBuilder.HasDefaultSchema is a new Code First API that allows the default database schema for a Code First model to be configured in one place. Previously the Code First default schema was hard-coded to "dbo" and the only way to configure the schema to which a table belonged was via the ToTable API.
    • DbModelBuilder.Configurations.AddFromAssembly method allows you to easily add all configuration classes defined in an assembly when you are using configuration classes with the Code First Fluent API. 
    • Custom Migrations Operations enabled you to add additional operations to be used in your code-based migrations.
    • Default transaction isolation level is changed to READ_COMMITTED_SNAPSHOT for databases created using Code First, allowing for more scalability and fewer deadlocks.
    • Entity and complex types can now be nestedinside classes.


    Best regards,

    Cole Wu

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 5, 2016 12:58 AM