3

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?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
JAN
  • 21,236
  • 66
  • 181
  • 318

2 Answers2

1

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

Community
  • 1
  • 1
LSU.Net
  • 829
  • 6
  • 17
0

You need to change the namespaces to

using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;