amin behzadi
amin behzadi

Reputation: 41

Error in using Dynamic Data Entities Web Site in VS2012

I decided to use Dynamic Data Entities Web Site in VS2012.

So, I created this Web Site, then added App_Code directory and added a new edmx to it and named it myDB.edmx. After that I uncommented the code line in Global.asax which registers the entity context :

DefaultModel.RegisterContext(typeof(myDBEntities), new ContextConfiguration() { ScaffoldAllTables = true });

But when I run the website this error occurs :

The context type 'myDBEntities' is not supported.

how can I fix it?

p.s: You now there are some differences between using L2S by Dynamic Data L2S Web Site and using Entity Framework by Dynamic Data Entities Web Site.

Upvotes: 4

Views: 5001

Answers (4)

NickNack76
NickNack76

Reputation: 1

Within the Global.asax file, uncomment the other RegisterContext line instead.

 DefaultModel.RegisterContext( _
           New System.Func(Of Object)(Function() DirectCast(New [Your edmx](), IObjectContextAdapter).ObjectContext), _
           New ContextConfiguration() With {.ScaffoldAllTables = True} _
         )

Upvotes: 0

Ehab Ibrahim
Ehab Ibrahim

Reputation: 1

  1. Delete the TT files from the model

  2. Change the "Code Generation Stategy" to "Default"

Upvotes: 0

Konstantin
Konstantin

Reputation: 806

This problem happens because in Visual Studio 2012 you get DbContext (instead of ObjectContext as in Visual Studio 2010) code generated by default for all new models created with the EF Designer. In order to solve one you need to revert back to ObjectContext code generation.

For more information see Reverting to ObjectContext in EF Designer.

Upvotes: 2

Tomas Dale
Tomas Dale

Reputation: 51

I am still looking for the reason, but right now the only option is to create the project in VS2010 and then migrate the project into VS2012 and then I don't have any problem running the application

Upvotes: 5

Related Questions