Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing Code generation from T4 to Legacy objectContext causes exceptions?

I created a new model :

  1. ADO.NET Entity Data Model

  2. EF Designer from database .

When I changed the Code generation from T4 to Legacy objectContext

I got :

The type or namespace name 'EntityClient' does not exist in the namespace 'System.Data'

The type or namespace name 'Objects' does not exist in the namespace 'System.Data'

The type or namespace name 'EdmSchemaAttribute' could not be found

Any idea how can I resolve this?

like image 790
JAN Avatar asked Apr 12 '26 13:04

JAN


1 Answers

Looks like you need to add the EF 6.0 DbContext Generator, as your current template is generating EF 5.0 code. See @boindil's answer.

I think your problem is, that your T4 templates, which generate the entitties and the context are still in EF version 5.

First you have to delete the current code generation items, which are in the code behind of the model, namely .Context.tt and .tt.Next add a new EF version 6 code generator with Right click in the model designer-> Add Code Generation Item ... -> EF 6.x DbContext Generator.

Upgrade from Entity Framework 5 to 6

like image 78
LSU.Net Avatar answered Apr 15 '26 01:04

LSU.Net