0

I am upgrading from EF4 to EF6 and have problems of getting the model to work. I use VS2012.

First I didn't get any code generated which under EF4 worked automatically. I changed EntityModel's Code Generation Strategy from None to Default and got classes generated.

But now my partial classes won't recognize any of the autogenerated class properties anymore.

Partial Public Class myObject
     '...
End Class

This class locates under the same Namespace as the autogenerated class. I didn't change anything in the partial classes.

For example when trying to access a navigation property from the partial class, Visual Studio complains: Error 16 'myObject_assumption' is not a member of 'MyNamespace.MyModel.myObject'

Is there something in EF6 I need to do to make it work?

Nuts
  • 2,755
  • 6
  • 33
  • 78
  • don't do the upgrade if you can wait a couple months, there's EF7 coming up – Sten Petrov Sep 03 '14 at 13:43
  • good to know. Unfortunately I can't wait that much here, need to stick with EF6 – Nuts Sep 03 '14 at 14:00
  • in that case - show us the generated code of myObject. Looks like DB-first? If so - take the table out and update from DB – Sten Petrov Sep 03 '14 at 14:01
  • 1
    Have you upgraded your Visual Studio EF tools([here](http://www.microsoft.com/en-us/download/details.aspx?id=40762))? Did you follow the instructions provided for upgrading from a previous version of EF to EF6 ([here](http://msdn.microsoft.com/en-US/data/dn469466))? – Radu Porumb Sep 03 '14 at 16:20
  • +1 for Visual Studio EF tools. I didn't have those. I also added EntityObject Generator (http://visualstudiogallery.msdn.microsoft.com/ff479d55-2c85-43c5-a4d6-21cd659435ea). – Nuts Sep 03 '14 at 18:57
  • But my Model.Designer.vb file stays empty, and saying: ' T4 code generation is enabled for model '....edmx'. ' To enable legacy code generation, change the value of the 'Code Generation Strategy' designer ' property to 'Legacy ObjectContext'. This property is available in the Properties Window when the model ' is open in the designer. – Nuts Sep 03 '14 at 18:57
  • ' If no context and entity classes have been generated, it may be because you created an empty model but ' have not yet chosen which version of Entity Framework to use. To generate a context class and entity ' classes for your model, open the model in the designer, right-click on the designer surface, and ' select 'Update Model from Database...', 'Generate Database from Model...', or 'Add Code Generation ' Item...'. – Nuts Sep 03 '14 at 18:58

0 Answers0