Up Model

Working with EF 6

Last modified on September 30, 2014 14:00

You can use Entity Framework 6 with DevForce 2012 as of version 7.2.2.


  • Install the EntityFramework 6.x NuGet package to the model project.  In a 2-tier application you should also install the package to your application executable project, while in an n-tier application the package should be installed to the web/server project.

  • For an existing EDMX-based model: Delete or update the .tt associated with the EDMX.

    The CodeGenerator assembly which should be referenced by the .tt is based on the EF version you are using in the project:  IdeaBlade.VisualStudio.OM.CodeGenerator.EF5.dll or IdeaBlade.VisualStudio.OM.CodeGenerator.EF6.dll.  If you have not customized the code generation process, delete the *.edmx.tt file from your project so that DevForce will generate a new file with the correct assembly reference.  If you have customized code generation, change the assembly name as noted above.

  • The IdeaBlade.DevForce.Server NuGet package contains DevForce support for both EF 5 and EF 6.  When you add this package you'll note that it adds references to both:

    At runtime, DevForce will dynamically load the appropriate assembly based on the version of EF your application is using.


  • In Visual Studio 2013, when creating a new EDMX model using the designer you will be prompted to choose either EF 5 or 6.  The version of the EntityFramework NuGet package installed by the designer is 6.0.0.  DevForce will work with this package, but you may also update it to the latest EntityFramework package.

  • If you are upgrading an existing EDMX-based DevForce model in Visual Studio 2012, it is not necessary to install the EF Power Tools.

  • The IdeaBlade.DevForce.Aop package will install EF 5 if the EntityFramework package is not already installed.  It will work with both EF 5 and EF 6, and you can upgrade the EntityFramework package at any time.  If an EntityFramework package is already installed, the IdeaBlade.DevForce.Aop package will use what is already installed.

  • Your solution may not include a mix of EF 5 and EF 6 based models.  The executable/server project will support only one EF version.


  • When building an EDMX-based model you get the following error:  Metadata file 'IdeaBlade.VisualStudio.OM.CodeGenerator.11.0.dll' could not be found.  

    Delete the .tt file and re-save the EDMX, as noted above.

  • At runtime you receive an EntityServerException with the following message: Assembly 'IdeaBlade.EntityModel.Edm.EF6' not found.  This assembly is required when using EF 6.

    Make sure that the EntityFramework.dll and EntityFramework.SqlServer.dll assemblies are deployed to the bin folder on your server. DevForce will load the appropriate IdeaBlade.EntityModel.Edm.* assembly based on the EF version it finds.

  • There is no longer a static dependency on the IdeaBlade.EntityModel.Edm assembly, as the EF-specific version is dynamically loaded at runtime.  You will need to ensure that the appropriate assembly version is deployed with your application.

Performance note

To improve startup performance you can use Ngen.exe to generate a native image for EntityFramework.dll.  This is highly recommended and can save up to 3 seconds in start up time.  See Improving Startup Performance with NGen for more information.



Created by DevForce on October 27, 2013 16:57

This wiki is licensed under a Creative Commons 2.0 license. XWiki Enterprise 3.2 - Documentation. Copyright © 2015 IdeaBlade