Share via


EF6 Release Candidate Available

 


The information in this post is out of date.

EF6 RTM is now available.

Visit msdn.com/data/ef for the latest information on current and past releases of EF.


 

We are now in the final stages of bug fixing for EF6 and are pleased to announce the availability of EF6 Release Candidate.

 

Getting Started with RC

The runtime is available on NuGet. If you are using Code First then there is no need to install the tooling. Follow the instructions on our Get It page for installing the latest pre-release version of Entity Framework runtime.

The tooling for Visual Studio 2012 is available on the Microsoft Download Center. If you are using the Visual Studio 2013 Preview, you can upgrade to the EF6 RC runtime and the tooling included in the preview will continue to work. You only need to install the tooling if you want to use Model First or Database First.

Note: In some cases you may need to update your EF5 code to work with EF6, see Updating Applications to use EF6.

Uninstalling RC Tooling in Visual Studio 2012

When you install the RC tooling it will replace the EF Designer that was included in Visual Studio 2012. To revert back to the tooling that was included with Visual Studio 2012 follow these steps.

  1. Using Add/Remove Programs, uninstall Entity Framework 6 Tools RC1 for Visual Studio 2012
  2. Repair your Visual Studio 2012 install
  3. To verify the repair, ensure that Entity Framework Designer for Visual Studio 2012 is listed in the installed programs list

 

What's Changed Since Beta 1

The following features and changes have been implemented since Beta 1:

  • Interception/SQL logging provides low-level building blocks for interception of EF operations with simple SQL logging built on top. We've created a feature specification for this feature and Arthur Vickers has created a multi-part blog series covering this feature.
  • Testability improvements make it easier to create test doubles for DbContext and DbSet. We’ve created walkthroughs showing how to take advantage of these changes using a mocking framework or writing your own test doubles.
  • Extensive API changes as a result of polishing the design and implementation of new features. In particular, there have been significant changes in Custom Code First Conventions and Code-Based Configuration. We’ve updated the feature specs and walkthroughs to reflect these changes.
  • EF Designer now supports EF6 in projects targeting .NET Framework 4. This limitation from EF6 Beta 1 has now been removed.

 

Support

This is a preview of features that will be available in the final release of EF6 and is designed to allow you to try out the new features and report any issues you encounter. It is not intended or licensed for use in production.

If you need assistance using the new features, please post questions on Stack Overflow using the entity-framework tag.

 

What's Next

RC contains all the features we are planning to implement for the EF6 release. We’ve also finished polishing the API surface, adding intellisense documentation, and everything else it takes to finish a release. Between RC and the final release we’ll just be fixing any bugs that come up.

The final release of EF6 will be made available at the same time as Visual Studio 2013 – later this year.

Because we’re pretty much locked down for EF6 we aren’t accepting pull requests for this release. But our master branch is ready to start accepting changes for the next release. We don’t know what the next release will be yet, but probably EF6.1 or EF6.0.1. If you want to try out the latest changes from our master branch -  keeping in mind that some of the changes won’t be in EF6 –  you can use the latest signed nightly build.

You can also follow us on Twitter and Facebook to stay up to date with what our team is working on.

 

What Else is New in EF6

This is the complete list of new features in EF6.

Tooling

Our focus with the tooling has been on adding EF6 support and enabling us to easily ship out-of-band between releases of Visual Studio.

The tooling itself does not include any new features, but most of the new runtime features can be used with models created in the EF Designer.

Runtime

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

  • Async Query and Save adds support for the task-based asynchronous patterns that were introduced in .NET 4.5. We've created a walkthrough and a feature specification for this feature.
  • Connection Resiliency enables automatic recovery from transient connection failures. The feature specification shows how to enable this feature and how to create your own retry policies.
  • Code-Based Configuration gives you the option of performing configuration – that was traditionally performed in a config file – in code. We've created an overview with some examples and a feature specification.
  • Dependency Resolution introduces support for the Service Locator pattern and we've factored out some pieces of functionality that can be replaced with custom implementations. We’ve created a feature specification and a list of services that can be injected.
  • Interception/SQL logging provides low-level building blocks for interception of EF operations with simple SQL logging built on top. We've created a feature specification for this feature and Arthur Vickers has created a multi-part blog series covering this feature.
  • Testability improvements make it easier to create test doubles for DbContext and DbSet. We’ve created walkthroughs showing how to take advantage of these changes using a mocking framework or writing your own test doubles.
  • 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.
  • 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).
  • Default transaction isolation level is changed to READ_COMMITTED_SNAPSHOT for databases created using Code First, potentially allowing for more scalability and fewer deadlocks.
  • DbContext.Database.UseTransaction and DbContext.Database.BeginTransaction are new APIs that enable scenarios where you need to manage your own transactions.
  • Improved performance of Enumerable.Contains in LINQ queries.
  • Significantly improved warm up time (view generation) – especially for large models – as the result of a contributions from AlirezaHaghshenas and VSavenkov
  • Pluggable Pluralization & Singularization Service was contributed by UnaiZorrilla.
  • Improved Transaction Support updates the Entity Framework to provide support for a transaction external to the framework as well as improved ways of creating a transaction within the Framework. See this feature specification for details.
  • Entity and complex types can now be nested inside classes.
  • Custom implementations of Equals or GetHashCode on entity classes are now supported. See the feature specification for more details.
  • DbSet.AddRange/RemoveRange were contributed by UnaiZorrilla and provides an optimized way to add or remove multiple entities from a set.
  • DbChangeTracker.HasChanges was contributed by UnaiZorrilla and provides an easy and efficient way to see if there are any pending changes to be saved to the database.
  • SqlCeFunctions was contributed by ErikEJ and 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. We’ve created a walkthough and a feature specification for this feature.

  • Code First Mapping to Insert/Update/Delete Stored Procedures is now supported. We’ve created a feature specification for this feature.

  • Idempotent migrations scripts allow you to generate a SQL script that can upgrade a database at any version up to the latest version. The generated script includes logic to check the __MigrationsHistory table and only apply changes that haven't been previously applied. Use the following command to generate an idempotent script.

     Update-Database -Script -SourceMigration $InitialDatabase
    
  • 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. We’ve created a feature specification for this feature.

  • 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. We’ve created a feature specification for this feature.

  • 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  was contributed by UnaiZorrilla. If you are using configuration classes with the Code First Fluent API, this method allows you to easily add all configuration classes defined in an assembly. 

  • Custom Migrations Operations were enabled by a contribution from iceclow and this blog post provides an example of using this new feature.

Comments

  • Anonymous
    August 22, 2013
    I'm trying to get an example to work using EF 6 beta-1 (vs2013 preview) where I supply my own users table (or attempt to extend the one created) but hit lots of issues. first issue was I couldn't get it to create the tables on sql server 2008, so I allowed it to create them on localdb and then copied the definitions over. I've been using this example stackoverflow.com/.../custom-membership-with-microsoft-aspnet-identity-createlocaluser-fails to try and do get custom users to work, but no joy. I'm using model first if that makes any difference is there any up-to-date blog entry that describes this scenario using the latest code base? Will beta1 address any of the issues above and when will it be available on nuget to try?

  • Anonymous
    August 22, 2013
    I thought that the EF PowerTools features were going to be rolled into this tooling release? We've been waiting for the release of Generate Code First from Database along with EF6.

  • Anonymous
    August 22, 2013
    @MgSm88 - That was our original plan but unfortunately we had to cut the feature from the EF6 release (we are definitely still planning to do it after EF6). Because of this we are going to update the Power Tools to work with EF6 in time for the EF6 RTM.

  • Anonymous
    August 22, 2013
    Appears to be a version reference issue with ASP.NET Identity still. If i upgrade from beta to rc1 of ef6 i get the same error as listed in this work item.. entityframework.codeplex.com/.../1368 stackoverflow.com/.../could-not-load-type-system-data-entity-dbsetextensions-from-assembly-entityfr is there any updated on this issue? otherwise ef rc1 is with aspnet identity until a patch has been released?

  • Anonymous
    August 22, 2013
    @Tim B: A refresh of ASP.NET Identity that supports EF6 RC will be available soon.

  • Anonymous
    August 22, 2013
    @Diego B Vega [MSFT]: thanks for the reply thats good news. i'll roll back to beta locally then as im guessing soon doesn't mean this working  day? :) Incidentally is aspnet identity still closed source as i couldn't see any repository or section of the aspnet source which i could look for workitems Cheers Tim B

  • Anonymous
    August 23, 2013
    The refresh of the ASP.NET Identity Framework with support for EF6 RC is live in NuGet: www.nuget.org/.../1.0.0-rc1

  • Anonymous
    August 24, 2013
    modelBuilder.Entities() not working?

  • Anonymous
    August 24, 2013
    @Arvind: the Entities method was renamed to Types as part of the API cleanup we did in preparation for the final release. It can be used to configure complex types as well as entities.

  • Anonymous
    August 25, 2013
    After the upgrade to EF6 we get the following error upon initialization of the object context: "No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlClient'". Is something missing in web.config/app.config to make EF6 work? NOTE: Our business logic / data access classes are in a separate project/assembly from the MVC web app - perhaps something did not get initialized as it should with the NuGet upgrade in this scenario.

  • Anonymous
    August 26, 2013
    @Marcel Bradea, Ensure EntityFramework.SqlServer.dll is being deployed with your application.

  • Anonymous
    August 26, 2013
    @Jonathan Mc Namee - Are you asking about adding data to the ASP.NET Identity users table? If so, there is an example here - github.com/.../AspnetIdentitySample.

  • Anonymous
    August 29, 2013
    Since EF6 is supported in projects targeting .NET 4.0, is there EF6 tooling available for Visual Studio 2010?

  • Anonymous
    September 01, 2013
    @Rowan - not exactly, I have my own existing user entities and I'm trying to get EF to play nice with them.

  • Anonymous
    September 02, 2013
    Is there any "Entity Framework 6 Tools RC1" for VS 2010 ? How do I get DbContext generator in VS2010?

  • Anonymous
    September 03, 2013
    @Jonathan Mc Namee - Could you start a question on StackOverflow using the entity-framework tag and we will help you resolve the issue. Please include the code for the class you are trying to use, the model you have defined in the EF Designer, and details of any errors you are getting etc. Feel free to post a link to the question here and I'll make sure it gets looked at.

  • Anonymous
    September 03, 2013
    Hi, I've done some extensive testing of EF4 vs 5 vs 6 RC using actual application (Lists retrieval & CRUD) and found that EF6 RC is significantly slower than both EF4 and EF5. Am i missing something? EF6 & .NET4:  -  UpdateMembersFromValidPayrollTransformRecords = 4705 msec EF5 & .NET4  -  UpdateMembersFromValidPayrollTransformRecords = 2392 msec EF4 & .NET4:  -  UpdateMembersFromValidPayrollTransformRecords = 2612 msec Getting similar results in .NET5. Tested on different servers and local, using compiled and debug code and with ChangeTracking toggled.

  • Anonymous
    September 03, 2013
    Sorry, i meant "getting similar results in .NET 4.5"

  • Anonymous
    September 03, 2013
    Hello, Will the Entity Framework 6 RC1 be the same to its lower versions for implementing EFCaching Provider?

  • Anonymous
    September 04, 2013
    @Mike C & @Cristi - We won't be shipping the complete EF tooling for VS2010 but we will make 'EF6.x DbContext Generator' code generation templates available on VS Gallery so that you can use the existing designer in VS2010 and generate code that will work with the EF6 runtime. We're working on templates at the moment and will have them uploaded before RTM of EF6.

  • Anonymous
    September 04, 2013
    @AndreM - Are you able to provide some code that demonstrates the performance issue you are seeing? If so, please open a new issue on CodePlex - entityframework.codeplex.com/.../Create.

  • Anonymous
    September 04, 2013
    @Fred Bao - We haven't looked at making the caching provider work with EF6 at this stage (the provider is written and maintained by a former member of the EF team). One of our team members is planning to look at it, but it won't be until we've finished working on the RTM of EF6. One of the main things would be to update the code to work against the moved provider model in EF6. If you wanted to try, there are details on upgrading providers here - entityframework.codeplex.com/wikipage.

  • Anonymous
    September 07, 2013
    @Rowan - I've finally managed to resolve my issue - it was seemingly due to an odd connection string. I recreated project from scratch and it was the only obvious thing that was different. Any ideas why the first connection string would have been generated in this way? Now all I need to do is force the login to use my main connection string :) <connectionStrings><!--original-->    <add name="DefaultConnection" connectionString="metadata=res:///Entities.csdl|res:///Entities.ssdl|res:///Entities.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=MyDatabase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />    <add name="MyDatabaseEntities" connectionString="metadata=res:///Entities.csdl|res:///Entities.ssdl|res:///Entities.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=MyDatabase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />  </connectionStrings>    <connectionStrings><!--new-->    <add name="DefaultConnection" connectionString="Data Source=localhost;Initial Catalog=MyDatabase;Integrated Security=True" providerName="System.Data.SqlClient" />    <add name="MyDatabaseEntities" connectionString="metadata=res:///Entities.csdl|res:///Entities.ssdl|res://*/Entities.msl;provider=System.Data.SqlClient;provider connection string="data source=localhost;initial catalog=MyDatabase;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />  </connectionStrings>

  • Anonymous
    September 09, 2013
    @Jonathan Mc Namee - I haven't seen that one before, looks like the Default string got swapped to an EF Designer connection string. If you see it again and are able to provide a set of steps to reproduce it then feel free to open an issue - entityframework.codeplex.com/.../Create. My guess is that it will be a one time issue though.

  • Anonymous
    September 10, 2013
    I was just going to install the RC and give it a whirl in hopes that batch update speed or speed in general might be better. However, I just read that EntityDataSource doesn't work with it. So, I'm glad that I didn't. Repairing Visual Studio isn't a fun experience. Especially when you have to reinstall numerous other updates after the fact. It would be great if Visual Studio moved towards more of an XCOPY install. The current installer is very slow. Not sure exactly what it's doing. Presumably, writing out millions of registry values for COM. Hopefully, EntityDataSource will be fixed in VS 2013 so that  you don't have to convert a DbContext into an ObjectContext like you do now.

  • Anonymous
    September 12, 2013
    Are nested queries addressed in EF 6?

  • Anonymous
    September 13, 2013
    The comment has been removed

  • Anonymous
    September 16, 2013
    @Arturo Martinez - What particular issue are you asking about?

  • Anonymous
    September 17, 2013
    Will EF6 support outer joining to table valued functions within a LINQ query?  EF5 generates a runtime error if you attempt this. My related post on Stack Overflow: stackoverflow.com/.../entity-framework-5-how-to-outer-join-table-valued-function

  • Anonymous
    October 11, 2013
    The mocking tutorial you link to does not work for me. See my issue stackoverflow.com/.../how-to-mockup-enityframework-6-with-moq-autofixture

  • Anonymous
    October 11, 2013
    @chobo2: I already responded to you in CodePlex but answering here for other's benefit: It is possible that not all the changes necessary to mock DbSet made it into RC1. Could you try with the nightly builds instead?

  • Anonymous
    October 18, 2013
    The comment has been removed

  • Anonymous
    October 21, 2013
    @George - Can you check that you have a connection called DBDBEntities in the config file. If you have your model in a separate project, make sure that this is the config file for the startup project (not the class library that the model is in). If all that seems ok can you startup a thread on StackOverflow using the entity-framework tag (it would be great if you could include the contents of the config file). Feel free to reply with the link here and I will be sure to follow up on it.