Change EF 6 Code Generation Strategy from T4

c# entity-framework

Question

In the past I have successfully created edmx files. This was using EF5 and Visual Studio 2012. I have since upgraded to Visual Studio 2013 and EF6. The existing EF 5 code still works, but now I have a problem. I can create edmx files, and an EntityDataSource, I can configure the data source, it sees the tables and columns fine, but when I try to refresh the schema I get:

The schema could not be determined because of the following error from the EntityDataSource:

Could not find the CLR type for (my type here)

I have seen a solution on-line telling me to change my Code Generation Strategy to default (the existing edmx files created in EF 5 are set as Legacy ObjectContext), but it won't let me do this because the option 'T4' is grayed out.

enter image description here

Is there a way I can force the Code Generation Strategy to not use T4?

EDIT:

Pawel states that EntityDataSource does not support EF 6. Is there a tutorial available that shows an easy step-by-step guide of how to connect to EF 6? I have got all my EF information from the book Beginning ASP.Net 4, but it is now obviously out-dated. I see that EF 6 is still in beta stage. Maybe they'll add support for EntityDataSource at some stage?

EDIT 2:

OK, I've been fiddling around with this for a bit, and I can connect using LinqDataSource. I won't get a chance to play around with it much for a few days, but it looks like this works.

EDIT 3:

Using LinqDataSource doesn't work. The only CRUD operation it can perform is Read. Obviously there must be a way to use the new EF 6.0 framework (Pawel has suggested I use MVC), but they couldn't have broken it completely for my scenario (using web site), could they?

EDIT 4:

I have found a solution for my scenario, see my answer below.

1
18
10/16/2013 6:25:13 PM

Accepted Answer

Due to changes in EF6 if you are using EF6 in VS2012/VS2013 the only supported generation strategy is T4. You can get EntityObject based entities and ObjectContext based context by using T4 templates from VS Gallery. Note: EntityDataSource does not currently support EF6.

EDIT

The preview of the EntityDataSourceControl with EF6 support is now available

12
2/27/2014 4:35:13 PM

Popular Answer

i already have VS2013 Community, and i was fighting with the same problem. Just like your image, the code generation strategy was disabled, i mean, it wasn't possible to change, but... right click on the property name "Code Generation Strategy" then just click 'Reset' and the property value will change to Legacy ObjectContext!

I hope that it can help someone!

PD:Sorry, my english is aweful! xP



Related Questions





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