Accepted Answer

  1. You remove your previous.tt files.
  2. You launch the designer mode of your edmx file (so you can see your model)
  3. Right-click a vacant area.
  4. the Add Code Generation Item option
  5. Choose "EF 6.x DbContext Code Generation Item" from the dialog box (something like this)
  6. Save your edmx, and all classes with the new namespaces and other information will be produced for you.
56
10/21/2013 2:36:26 PM

Popular Answer

In addition to the responses provided by Dean Oliver and Rand Random above, let me draw attention to the following Link to MSDN, which outline general steps. for transitioning to EF6. Don't undervalue the manual labor necessary...

The road map is (see specifics in the aforementioned link):

  1. Preparation: Activate the Tools for Entity Framework 6 in Visual Studio 2012/13

  2. Activate the NuGet package for EF6

  3. Make sure to delete installation references and System.Data.Entity.dll (Note: Installing the EF6 NuGet package should automatically remove any references to System.Data.Entity from your project for you).

  4. Any EF Designer (EDMX) models should be switched to use the code generation in EF 6.x.

    Notes:

    • The tables will be displayed if you click the link modify in the displayed text message "The entity Data Model Designer... You can modify..." if you receive the message "The Entity Data Model Designer is unable to display the file you requested" afterward. Choose all usingCtrl +A and then clickDel ultimately save using a right-click and the option to "Update model from database"Ctrl +S . By utilizing the default T4-Template "EF 6.x DbContext Generator," this will update the model to the most recent version.

    • If you've employedObjectContext You ought to think about downloading the template EntityObject Generator for EF 6.x if it would help your project. Then, in the model designer, right-click and select "Add code generation item," after which you should select a name you haven't yet used. The correct classes will be generated, however you must first remove all previous ("*.tt files and associated created classes ("*.cs ") files.

  5. If basic EF types is being utilized, use Refresh namespaces instead, i.e.

    • any kind inSystem.Data.* is changed toSystem.Data.Entity.Core.*
    • System.Data.EntityState => System.Data.Entity.EntityState
    • System.Data.Objects.DataClasses.EdmFunctionAttribute => System.Data.Entity.DbFunctionAttribute .
      Note: A class with the previous name still exists and is functional, but it has been designated as obsolete for this new class.
    • System.Data.Objects.EntityFunctions => System.Data.Entity.DbFunctions .
      Note: A class with the previous name still exists and is functional, but it has been designated as obsolete for this new class.
    • Space classes (likeDbGeography , DbGeometry ) have relocated to
      System.Data.Spatial => System.Data.Entity.Spatial

N.B.:







Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow