EF6 RTM Available

Today we are pleased to announce the RTM of Entity Framework 6. The RTM of Visual Studio 2013 was also released today – you can read more about this release on Soma’s blog. Be sure to save the date for Visual Studio 2013 Launch on Nov 13th.

 

Getting EF6

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 version of Entity Framework runtime.

The tooling for Visual Studio 2013 is included in-the-box. If you are using Visual Studio 2012, the tooling is available on the Microsoft Download Center. 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.

 

What’s New in EF6

Tooling

The focus for the tooling in EF6 was to add support for the EF6 runtime and to enable shipping 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.
  • Connection Resiliency enables 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 Resolution introduces 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 nested inside classes.

 

Improving Startup Performance

The 6.0.1 Patch Release

The 6.0.0 version of the EF package needed to be locked down early to be included in Visual Studio, ASP.NET, etc. After this lock down a number of important issues came to our attention that we felt were important to fix ASAP.

To deal with this, we are also publishing an EF 6.0.1 patch on NuGet today. If you install from NuGet you will automatically get the latest patch version. If you use a VS2013 project template that already has EF6 installed, or if the EF6 tooling installs the NuGet package for you, we would recommend updating to the latest patch version. You can do this by running Update-Package EntityFramework in Package Manager Console.

The 6.0.1 patch release is limited to fixing issues that were introduced in the EF6 release (regressions in performance/behavior since EF5). The most notable changes are to fix some performance issues during warm-up for EF models – this was important to us as we significantly improved model warm-up time in other areas in EF6 and have been listing it as a feature. You can see a complete list of the individual fixes on our CodePlex site.

Improving Performance with Ngen

Prior to EF6, a large portion of Entity Framework was included in the .NET Framework. This meant that most of Entity Framework automatically has native image generation run on it to reduce the just-in-time (JIT) compilation cost.

Because EF6 ships as a completely out-of-band release, native image generation is no longer performed automatically. This can result in an increased warm-up time for your application while JIT compilation occurs – we have seen results of around 1 second.

To remove this JIT time you can use Ngen to generate native images for the Entity Framework assembly on your machine. For more information, see Improving Startup Performance with NGen.

 

Contributors

For EF6 we moved to an open source development model. We would like to thank the following contributors for helping to make EF6 a great release.

 

What’s Next

We’re currently in the planning phase for the releases that will follow EF6. We’ll post up a roadmap and plans once we’ve got something a little more concrete.

Comments

  • Anonymous
    October 16, 2013
    Congratulations and thanks for the hard work. Such a great time to be a .NET developer.

  • Anonymous
    October 16, 2013
    When I upgrade, how can I update TT files to generate correct code? It is still importing    using System.Data.Objects;    using System.Data.Objects.DataClasses; I am also getting this error: 'Void System.Data.Entity.ModelConfiguration.EntityTypeConfiguration`1.ToTable(System.String)'. That library uses EF 4.3.1

  • Anonymous
    October 16, 2013
    I updated TT files. but I still can´t use ToTable method, the signature was changed from public void ToTable(string tableName); To public EntityTypeConfiguration<TEntityType> ToTable(string tableName);

  • Anonymous
    October 16, 2013
    @Felipe Fujiy - I'm a little unclear on the scenario you have. If you are generating code from an EDMX then you should swap to the EF6.x templates (DbContext is included with the EF6 tooling and ObjectContext is available on VS Gallery). However, using ToTable is only when using Code First. Could you elaborate a little?

  • Anonymous
    October 16, 2013
    The first issue is ok, I deleted tt files and created again choosing EF6 Templates. I have a DLL that uses EF 4.3.1 and calls ToTable method, but the signature was changed in EF6. When I use that DLL at my website, I get that error. I changed my library to use TableAttribute instead, now its ok. But it is a breaking change.

  • Anonymous
    October 17, 2013
    How can I get DbContext Generator for EF 6 on Visual Studio 2010 ? It was said on an earlier post that it will be made avalaible before the RTM...

  • Anonymous
    October 17, 2013
    @Felipe Fujiy - We made that change to allow additional calls to be chained after ToTable. I assume you are using reflection to call the API? Any code that calls the Fluent API directly should compile just fine with the change.

  • Anonymous
    October 17, 2013
    @Missing - We haven't published one at this stage. We decided to hold off and see if there was much demand for it - counting that as one vote so far :). It's not ideal, but if you have a machine with VS2012 on it, you can install the VS2012 tooling and then grab out the tt files - they should work ok on VS2010 (though I haven't tried it).

  • Anonymous
    October 17, 2013
    congrats for releasing Version 6 :) Firebird has an issue with EF6 when you use the DDEX provider: tracker.firebirdsql.org/.../DNET-522 Is this provider split the only solution to get the VS working with Provider and using EF6? Will this split be the same for EF7? Jiří Činčura only wants to split the provider if this doesn't change again for EF7.

  • Anonymous
    October 17, 2013
    @Felipe Fujiy: To add to Rowan's comment, a DLL already compiled against EF 4.3.1 is not guaranteed to work with EF6. There are intentional breaking changes in the API of EF6 and although most code that targets DbContext and Code First should work just fine after recompiling it you may need to modify your code in some cases. See the link to "Updating Applications to use EF6" in the blog post for more details.

  • Anonymous
    October 17, 2013
    @Andre.Ziegler - Yes, this was a one time change to help us move out of the .NET Framework. The split will remain the same for upcoming releases.

  • Anonymous
    October 17, 2013
    thanks Rowan for answering it :)

  • Anonymous
    October 17, 2013
    Good job guys! Has the tooling for generating views made the cut for the RTM as promised? Could you possibly add a blurb in this post to clarify how that works? Does it come with Visual Studio 2013 or is there a separate download needed (ie: EF Power Tools Beta 4)? This blog post (blogs.msdn.com/.../ef-power-tools-beta-4-available.aspx) seems to suggest the tooling will work with the RTM release - are we then still waiting on an upcoming release of the EF Power Tools before view generation will work with EF6 RTM?

  • Anonymous
    October 17, 2013
    I am using an internal Nuget server. I can´t recompile targeting EF6 because I have web sites using EF 4.3. Table attribute worked fine.

  • Anonymous
    October 17, 2013
    @Marcel Bradea - Power Tools were updated to work with EF6 RTM including support for view generation. I also updated my T4 template for generating views for EF6 on Visual Studio Gallery. You can get it from here: visualstudiogallery.msdn.microsoft.com/18a7db90-6705-4d19-9dd1-0a6c23d0751f

  • Anonymous
    October 17, 2013
    @Rowan Miller - Hi mr Miller. I'm very pleased of the announcement of the RTM :0) Thanks a lot

  • Anonymous
    October 17, 2013
    :) Valeu galera do ADO.NET. Já vai pro projeto novo.

  • Anonymous
    October 17, 2013
    @Felipe Fujiy - BTW I added info about swapping the tt files to the 'Upgrading to EF6' page.

  • Anonymous
    October 18, 2013
    I can't seem to get it to install from NuGet on F# projects - see stackoverflow.com/.../getting-ef-6-from-nuget-to-install-on-f-projects and entityframework.codeplex.com/.../891. Any suggestions?

  • Anonymous
    October 18, 2013
    Hello, when can we expect to use also "SELECT" Stored Procedures in EF (not only for I/U/D) robert

  • Anonymous
    October 21, 2013
    @Robert - You can do it pretty easily already using the techniques shown here msdn.microsoft.com/.../jj592907. We do have an item on our backlog to add support for function imports in Code First. But using the current bits, if you wrap the raw sql call to a sproc in a method on your derived context then it will look basically the same to your application code.

  • Anonymous
    October 21, 2013
    @Ken Smith - We weren't able to fix that issue in the 6/6.0.1 releases. It's currently scheduled to be fixed in the next set of releases - though that's not a 100% definite commitment that it will be fixed. For the moment you could manually reference the assemblies.

  • Anonymous
    October 21, 2013
    Hi. Will there be a new version of Microsoft.AspNet.Providers.Core (1.3 ?) with EF6 support soon? No rush right now though since I can use the version 1.1 for now, but just wondering.

  • Anonymous
    October 21, 2013
    @koichia: There will be an update for ASP.NET Universal Providers that will have support for EF6. The .NET Web Development and Tools Blog (blogs.msdn.com/.../webdev) is a good place to check for updates on Universal Providers.

  • Anonymous
    October 21, 2013
    @Rowan: what I mean with SELECT Stored Procedures was to select a SP and the Designer should build the Entity from the result of that SP - all of our Data access goes through Stored Procedures for Select/Insert/Update/Delete and the SELECT result doesn't often map to tables because we return special columns from multiple tables... robert

  • Anonymous
    October 22, 2013
    Does anyone know if EntityDataSource has been updated to work with EF 6? I'm thinking if I use Visual Studio 2013 I'll be all right?

  • Anonymous
    October 22, 2013
    @Jon - We are wrapping up some updates to the Entity Data Source to make it work with EF6. We'll be releasing it soon.

  • Anonymous
    October 22, 2013
    @Rowan Cool. Can you make it so that it looks for DbContext or ObjectContext? The way it works now, if you're using DbContext, you have to handle the ContextCreating event and specify the context programmatically.

  • Anonymous
    October 22, 2013
    @Diego B Vega - Thanks for the info. I will check the The .NET Web Development and Tools Blog then :)

  • Anonymous
    October 22, 2013
    It seems that EF6 wants to update the structure of any DateTimeOffset fields.  Taking a simple test project created with EF5 including a DateTimeOffset field, enabling migrations (not-automatic), then upgrading to EF6, the project won't run without a migration being added.  The migration seems to just specify the precision: AlterColumn("dbo.MyTable", "DateRemoved", c => c.DateTimeOffset(precision: 7)); With the reverse being AlterColumn("dbo.MyTable", "DateRemoved", c => c.DateTimeOffset()); I've found no mention of this in release notes or upgrade guides, so it may be worth bearing in mind.

  • Anonymous
    October 23, 2013
    Having issues with the designer edmx file will not open with the latest RTM EFTools for EF 6.0 in Visual Studio 2012 <Schema Namespace="Model1.Store" Alias="Self" Provider="System.Data.SqlServerCe.4.0" ProviderManifestToken="4.0" App.config was set by nuget to: <?xml version="1.0" encoding="utf-8"?> <configuration>  <configSections>    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />    <!-- For more information on Entity Framework configuration, visit go.microsoft.com/fwlink -->    <!-- For more information on Entity Framework configuration, visit go.microsoft.com/fwlink -->  </configSections>  <connectionStrings>    <add name="Hl7ModelContainer" connectionString="metadata=res:///Hl7Model.csdl|res:///Hl7Model.ssdl|res:///Hl7Model.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="Data Source=.HL7u.sdf"" providerName="System.Data.EntityClient" />    <add name="hl7SQLEntities" connectionString="metadata=res:///Hl7Db.csdl|res:///Hl7Db.ssdl|res:///Hl7Db.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=hl7_67SQL;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />  </connectionStrings>  <startup>    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />  </startup>  <entityFramework>    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">      <parameters>        <parameter value="System.Data.SqlServerCe.4.0" />      </parameters>    </defaultConnectionFactory>    <providers>      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />      <provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />    </providers>  </entityFramework> </configuration>

  • Anonymous
    October 23, 2013
    @Jon - can you provide more details? (like is it an existing edmx file (then please open a bug using entityframework.codeplex.com/.../Create and attach a file) or you are trying to reverse engineer your database and it does not work (then post the errors you see if any)). Is it possible that you are hitting this: entityframework.codeplex.com/.../1735 ?

  • Anonymous
    October 24, 2013
    @Jon - Yes, that change will be included in the version we release.

  • Anonymous
    October 24, 2013
    @Robert - That makes sense. We don't have that feature as yet and it's not on our backlog. Currently you would need to have the model generated from the table and then configure it to use SPs. Feel free to create a feature request here - entityframework.codeplex.com/.../Create.

  • Anonymous
    October 26, 2013
    May I know the roadmap of the next version? many thanks

  • Anonymous
    October 28, 2013
    @Michael - We are putting plans together but don't have anything public as yet.

  • Anonymous
    October 29, 2013
    There seems to be quite significant performance degradation between EF 5 and EF 6. More details avaialbale here: stackoverflow.com/.../entity-framework-performance-degradation

  • Anonymous
    October 30, 2013
    @Dydek - There are a couple of performance issues that we are working on fixes for at the moment. The most notable one is an issue that is only present when you have the debugger attached - entityframework.codeplex.com/.../1778. We're working on a plan to get this fix out ASAP as we realize this is very painful for folks developing their apps with EF6.

  • Anonymous
    November 01, 2013
    EDM does not exist in Visual Studio 2013 Ultimate Trial: stackoverflow.com/.../where-is-the-edm-tool-in-visual-studio-2013-ultimate-trial

  • Anonymous
    November 04, 2013
    @Marienplatz - One of our team members has followed up with the answer on the Stack Overflow thread.

  • Anonymous
    November 05, 2013
    While I applaud your hard work at getting this release out, I must say that I was entirely disappointed to discover that the Async named methods were only available for .Net 4.5. Why can't the methods like SaveChangesAsync simply return Task<int> and not use the async keyword? I realize the benefits of the async await pattern, but one can also make use of the TPL without out.  It was even backported to .net 3.5.   Due to the lack of XP support in .net 4.5 (the overwhelming majority of our healthcare industry customers use XP and will not be changing) , it is not likely we will be able to use it for the foreseeable future.  Even so, we have made heavy use of the TPL in our .net 4.0 products.  I certainly hope this is only an oversight or something that will be upcoming, as we had been waiting for awhile for this update, only to realize this much awaited functionality is not usable to anyone stuck at .net 4.

  • Anonymous
    November 05, 2013
    @CJL: Thanks for your feedback. We evaluated supporting async on .NET 4.0 but we found several blocking issues.  As you can guess although it is possible to target .NET 4.0 with the C# 5.0 compiler there are subtle differences in the runtime behavior and .NET 4.0 is lacking some of the changes that were made to better support async, e.g. on exception handling. Even more important, EF6 depends on the new Task-based async methods that were added to the ADO.NET provider model (i.e. in the classes under the System.Data.Common namespace) in .NET 4.5. Before .NET 4.5 only a subset of the async functionality existed in different providers like SqlClient but it wasn't exposed in the common provider model in a way that EF could consume them.   In case it helps clarifying, our highest priority was to enable async for server-side and cloud scenarios as opposed to the UI responsiveness scenarios that are more common in client/server applications. E.g. our implementation is mainly focused on freeing up threads to the thread pool whenever a database call happens on a Web application, so that they can be as quickly as possible assigned to service additional requests, and we will never spin up a new thread to do additional work in parallel. We also don't support concurrent access from multiple threads to our context objects. You can find the feature specification at entityframework.codeplex.com/wikipage for more details.

  • Anonymous
    November 07, 2013
    I'm wondering if anyone aside from me has thought that a Clear() method should be added to DbContext for clearing the object cache? This would be useful for batch processing. I see the lack of such a method as a real deficiency. I have heard that EF 6 was supposed to make allocating new DbContexts faster. So, you could simply allocate a new DbContext and dereference the previous one every n number of rows that are processed to free up memory. However, it sounds like EF 6 is actually slower now. I haven't been able to test yet as I'm using MySQL on a project and I'm waiting for an updated driver that supports EF 6. I would really like to see EF start using prepared statements for updates as well. I was surprised to find that it isn't doing that already. I think that would be easier to implement that batching of statements personally which is something else that someone was looking into.

  • Anonymous
    November 11, 2013
    @Jon: We considered in the past having such ability to reset the object tracking state of a DbContext but as you pointed out it you don't get much benefit since it is possible to create a new context instance every time you want to start anew. In fact in EF6 once the model is built (in the case of Code First) or loaded, we cache more information about how the EF model maps to your classes to make subsequent instances of the DbContext cheaper to create. Our internal performance testing show that this is indeed much faster in EF6 than it was in EF5. Thanks for your feedback about using prepared statements. We have the following work item in our backlog for it: entityframework.codeplex.com/.../912.

  • Anonymous
    November 19, 2013
    Are there any plans to release a Fluent API DbContext T4 Generator which works with EF6?

  • Anonymous
    November 19, 2013
    @Andre.Ziegler - The 'DbContext Fluent Generator' templates aren't produced by our team (a community member outside of Microsoft created and maintains them).

  • Anonymous
    November 20, 2013
    @Rowan Miller yes, I know this. I already asked him and he told me that he no longer updates them. That's why I ask if the EF Team can create an EF6 comaptible Version.

  • Anonymous
    November 20, 2013
    @Andre.Ziegler - We aren't planning to produce such a template. I'd be interested to know what you are using the template for. If I understand correctly you can hook it up to a model created in the EF Designer and have it generate a Code First model. If that is the case, I understand it could be useful for a one-time conversion from EF Designer -> Code First. But if you are actually using the designer to maintain the model then I don't see what advantage it provides, if you were to just let EF load the model from EDMX it would actually be a little bit faster. Let me know your thoughts... entirely possible that I'm missing something :)

  • Anonymous
    November 26, 2013
    @Rowan Miller I simply want to have classes without any references or attributes to/from EF. I replaced the EFFileTemplateManager with this www.nuget.org/.../T4.TemplateFileManager. I have a project with the EDMX and the T4 templates. Now I only generate the POCOs in the same project file and all EF related stuff (context, mapping) goes to a 2nd project. So I avoid that the GUI has a reference to the used ORM tool. With the buildin EF6 templates I loose this advantage because all files are generated in the same project and here I must reference EF.

  • Anonymous
    November 27, 2013
    @Andre.Ziegler - You can achieve that with the default code generation templates. There are separate templates that generate the entities (<model_name>.tt) and the context (<model_name>.Context.tt). The easiest way to do this is switch off code generation in the EF project (by clearing the CustomTool property of the file), then adding the tt file as a linked item in the second project. This way the file still exists in the same directory as the EDMX file and you don't need to update the path to the EDMX in the template.

  • Anonymous
    December 02, 2013
    @Rowan Miller ok, I've used the workaround. You should document this somewhere. I never thought of inserting the file as link. But I still use the custom T4 TemplateFileManager to move the generated context class into the other project and move the entities into a subfolder. I don't like having too many files into the root of the project. I noticed 1 issue with the VS tools. When adding the template, the already installed EF 6.0.1 references where replaced again with 6.0.0. I've updated EF again to 6.0.1 but now I now get a message the EF6.0.0 is missing during runtime of my program. I'll try to debug this tomorrow. Does VS have any tools to show miss matched references?

  • Anonymous
    December 03, 2013
    @Andre.Ziegler - The mismatched versions sounds like a bug, it would be great if you could open a new issue with details here entityframework.codeplex.com/.../Create.

  • Anonymous
    December 03, 2013
    @Andre.Ziegler - BTW you can also move the .tt file into your second project (so that all files are generated there), you just need to update the path to the .EDMX file at the top of the .tt file.

  • Anonymous
    December 05, 2013
    @Rowan Miller I created a workitem: entityframework.codeplex.com/.../1900 I had to remove and EF references and add them back to fix the issue. Please fix this for the EF6.0.2 tools. I still need to move them into a subfolder, to match the namespaces, so I still use the better TemplateManager from René. Now I still get errors during runtime, but this seems to be Fb provider related. Btw, can you please remove the SQL provider from the NuGet package and create a separate package for EF6.1? I use Firebird and having this useless reference is annoying.

  • Anonymous
    December 06, 2013
    @Andre.Ziegler - Thanks for opening the issue. It probably won't be fixed in 6.0.2 since that release is pretty much locked down now. But we'll look at it for the next release. If you want to change the namespace that code is generated in you can just set the 'Custom Tool Namespace' property on the tt file.

  • Anonymous
    December 06, 2013
    @Rowan Miller I know that I can define the namespace, but this doesn't move the files. I also run into an issue, that I get an UnintentionalCodeFirstException. I've commented this call out from the tt so that is not generated in the context.cs. Next, the old fluent Generator also created overloads of the context, where I can use different Connections strings. This should be also added to yours. But I can't use the whole Generator at all. The db tables have a different Name compared to the model. I changed this in the EDMX after I imported the model from the DB when I used EF4.1. Now all queries want to get data from tables which I don't have because there is no mapping. With the old Generator everything worked fine. I really miss the fluent Generator :'(

  • Anonymous
    December 06, 2013
    @Andre.Ziegler - Commenting out the UnintentionalCodeFirst exception isn't a good idea. That means EF is going to ignore your EDMX file and use Code First to build up a default model based on it's conventions - unlikely to align with what is actually in your database. You should make sure your EF connection string (the one in App/Web.config that includes pointers to the CSDL/MSL/SSDL that are generated from your EDMX) is in the App/Web.config of the startup application.

  • Anonymous
    December 08, 2013
    @Rowan Miller I think the connectionstring is fine (works fine with EF4/5). It is this: "add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception" The attributes are missing, but when I add attributes I must reference the EF Dll again which I don't want. The only way to solve this is to get a proper EF6 Fluent API generator. Because you don't want to create one, I can't use EF6. EF4/5 are slow so I think we'll stop our EF testing branch and never use EF again :( :(

  • Anonymous
    December 09, 2013
    Any update on a new version of entitydatasource that works with EF 6?

  • Anonymous
    December 09, 2013
    @Andre.Ziegler - If you are getting the exception then EF isn't finding your connection string with the EDMX based content in it (which is why it's trying to run Code First). Here is a great post to help you understand what is going on blog.oneunicorn.com/.../dont-use-code-first-by-mistake.

  • Anonymous
    December 09, 2013
    @PJK - We've got something that works internally but there are some updates required to Dynamic Data before the new EDSC will work with Dynamic Data. Given that almost every request we've had for EDSC is to enable Dynamic Data we're going to hold off until the Dynamic Data team gets a change to make the updates and test out our new EDSC. I'm sorry that I don't have a definite timeline on that - but it is near the top of their backlog.

  • Anonymous
    December 12, 2013
    @Rowan Miller - Thanks for the update.  Any chance of getting access to the non dynamic data EF6 version of the entitydatasource in the mean time?

  • Anonymous
    December 12, 2013
    I'm in the same boat as PJK. We have a legacy app that is littered with EntityDataSource controls that will no longer function due to EF6.  Anything to fix this would be of great help.

  • Anonymous
    December 16, 2013
    @DavidA - Is the EDSC without Dynamic Data support useful to you as well? Or do you require Dynamic Data?

  • Anonymous
    December 16, 2013
    @Rowan Miller I read this link several times, but it still doesn't explain my issue. The connection works fine. I use the context.Database.Connection.Open(); to check if the database is online. If the connectionstring is wrong this would fail. Now I also get VS crashes. After adding the EF6 T4 template I can't view the EDMX any longer and I see this error: "the file references an xml namespace that is inconsistent with the Entity Framework schema" When I click on the "modify" link the VS crashes, here is the Windbg output: STACK_TEXT:   unknown!Microsoft.XmlEditor.XmlStartTag..ctor+0xd unknown!Microsoft.XmlEditor.Literal.PushToBuffer+0x27f unknown!Microsoft.XmlEditor.Transaction.PushToEditorTreeAndBuffer+0x516 unknown!Microsoft.XmlEditor.Transaction.Complete+0x9b unknown!Microsoft.Data.Tools.VSXmlDesignerBase.Model.VisualStudio.VSXmlTransaction.Commit+0xe unknown!Microsoft.Data.Entity.Design.Model.Eventing.EfiTransaction.Commit+0x28 unknown!Microsoft.Data.Entity.Design.Model.Commands.CommandProcessor.PostProcessUpdate+0xd9 unknown!Microsoft.Data.Entity.Design.Model.Commands.CommandProcessor.Invoke+0x249 unknown!Microsoft.Data.Entity.Design.Model.Commands.CommandProcessor.InvokeSingleCommand+0x61 unknown!Microsoft.Data.Entity.Design.Model.Commands.RetargetXmlNamespaceCommand.RetargetArtifactXmlNamespaces+0x3f unknown!Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram.ReversionModel+0xe9 unknown!Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram.diagramWatermark_UpgradeLinkClicked+0xde unknown!Microsoft.Data.Entity.Design.EntityDesigner.View.EntityDesignerDiagram.diagramWatermark_LinkClicked+0x6c unknown!System.Windows.Forms.LinkLabel.OnLinkClicked+0x76 SYMBOL_STACK_INDEX:  0 SYMBOL_NAME:  unknown!Microsoft.XmlEditor.XmlStartTag..ctor+d FAILURE_BUCKET_ID:  WRONG_SYMBOLS_c0000005_unknown!Microsoft.XmlEditor.XmlStartTag..ctor

  • Anonymous
    December 17, 2013
    @Andre.Ziegler > "I use the context.Database.Connection.Open(); to check if the database is online. If the connectionstring is wrong this would fail." Even if it's not picking up your connection string with the EDMX info in it this would still work because it's falling back to Code First and will just pick a database via convention. That's why we put the UnintentionalCodeFirstException there - so you don't accidentally run in Code First mode. There probably isn't much else we can do over blog comments. If you are able to provide a project that reproduces the issue then feel free to open a CodePlex issue (with the project attached) and I can help you there - entityframework.codeplex.com/.../Create. ~Rowan

  • Anonymous
    December 17, 2013
    @Rowan Miller I tried to create a new demo project, but I can't even reverse engineer the model from the DB. I get a error that a provider is missing in the app.config and the link written in the error message points to an EF6 page: go.microsoft.com/fwlink. But this is an EF5 demo, the designer disables the EF6 radio button, so I guess he knowns it is EF5 :( And reverse engineer directly to EF6 also fails with a provider error. Firebird + EF seams to be nearly impossible to be used together :'( :'( :'( :'( :'(

  • Anonymous
    January 09, 2014
    @Rowan Miller after starting the migration from EF5 to 6 again I no longer get any errors, but the mappings from the EDMX is simply ignored. The generated queries use the original names of the database. really please provide a Fluent API T4 generator which works with EF6.

  • Anonymous
    January 09, 2014
    @Andre.Ziegler - Can you open a new issue on our CodePlex site and attach the project that is giving you issues - entityframework.codeplex.com/.../Create. Our team isn't planning to build a Fluent Generator because the correct (and best performing) solution is to correctly load the mappings from the EDMX file.

  • Anonymous
    February 07, 2014
    @Rowan Miller it works now after I started again from scratch with the update. It was indeed a connection string issue. When I use the Fluent Generator the EDMX is no longer used at all. I only use it to design the model and generate the fluent API CF code. But with your templates the other connectonString is still needed and uses the EDMX file. But I never used EF this way. I only used with the fluent generator from my first test application until now. Btw, will we get the PDB and source files for 6.1 to debug EF calls in our projects?

  • Anonymous
    February 12, 2014
    @Andre.Ziegler - We were blocked by some issues with SymbolSource, we'll follow up again to see if we can get the issues resolved.

  • Anonymous
    February 24, 2014
    The new BeginTransaction method which takes an IsolationLevel is ignoring whatever is passed in and always uses the default for the provider. Haven't been able to find any way of making a SELECT followed by a conditional INSERT transactional when using EF.  Even using TransactionScope doesn't help since EF only initiates the transaction when SaveChanges is called.

  • Anonymous
    February 26, 2014
    @Tony Whalen - If you have some example code where the IsolationLevel is being ignored, please open up a new issue on our CodePlex site so that we can dig into it - entityframework.codeplex.com/.../Create.

  • Anonymous
    February 27, 2014
    Thanks Rowan I’d like to retract my previous comment.  The IsolationLevel is working correctly in EF so I was just wrong about that. The issue remains however which is trying to perform a SELECT before an INSERT and have those statements work correctly in a concurrent environment.  What I mean by ‘correctly’ is that one SELECT should block the other until the first commits the INSERT. I now realise that you can’t even do that in SQL Server itself using just IsolationLevels.  In fact, the only way I’ve been able to achieve this in SQL Server is by applying the UPDLOCK table hint on the SELECT.  Note that using the SERIALIZABLE IsolationLevel does also work but produces frequent deadlocks which is unacceptable. Since there is no way of applying locking hints in EF, there is no way to resolve this issue using DbContext. i.e. the following code will never prevent concurrent users from inserting the same row: if (!context.CodeLookups.Any(lookup => lookup.Code == "NewCode")) {    context.CodeLookups.Add(new CodeLookup { Code = "NewCode", Description = "Test" });    context.SaveChanges(); } I really like EF and all the features it provides but this is a real show-stopper in a multi-user environment.  The only current way I know to resolve this is to use a stored procedure which uses UPDLOCK and then use context.Database.ExecuteSqlCommand. Now that EF6 wraps ExecuteSqlCommand in a transaction, this produces the desired effect. Are there any plans to support locking hints in EF in the future?

  • Anonymous
    March 04, 2014
    @Tony Whalen - It would be messy, but you could look at using command interception to tweak the SQL that is sent to the database to apply the locking hint - msdn.microsoft.com/.../dn469464. BTW another approach to the design that would be more 'optimistic' would be to introduce a unique constraint on the Code column and deal with the exception when it occurs. This would avoid all the locking etc. which is probably going to significantly slow things down and optimizes your application for the (presumably infrequent) scenario where there is a conflict. You could still do the initial check ahead of time, so you would only get the exception if someone happens to insert between the query and save.

  • Anonymous
    March 16, 2014
    @Rowan Miller - Thanks for the advice Rowan.  I agree that Interception would be a bit messy but it's a useful technique to know about.  I like your suggested design using a unique constraint and exception handling.  I think I'll go with that one!

  • Anonymous
    June 25, 2015
    Is there a T4 Template that I can use for the old ObjectContext after I've upgraded from EF5 to EF6.1?