Reputation: 525
How can I change code generation strategy to "Default" while creating ADO.net entity model class? When .edmx file is generated, it contains .tt files. I deleted those and want to regenerate using default code generation strategy. I was able to do this in Visual Studio 2012 but can't do this anymore in Visual Studio 2013. Code generation strategy is set to T4 and I can't regenerate the files. Any help?
Upvotes: 5
Views: 1306
Reputation: 665
I was facing an issue while changing code generation strategy to “default” in visual studio 2013. After four to five hours of research, I found this solution.
The Legacy ObjectContext is set now
To add these two references, right click on References folder and click on Add Reference. Now type "System.Data.Entity" in the search box, you will see these two references in the list. Select these references and click on OK button.
Hope this will work for everyone, Thanks.
Upvotes: 0
Reputation: 1607
I'm working with asp.net webform so I'm not sure my answer would be helpful to u or not...However This is my solution...
1.remove the last edmx file.
2.remove the last connection string.
3.add ado.net entity model again and set options like before.
4.DO NOT remove .tt files and DO NOT try to change code strategy generation.
5.rebuild solution.
6.I believe now you would see a lot of errors about AddObject
and DeleteObject
...Just change This two to Add and Remove (note that for deleteObject
you may not have had to write table name before but for remove you should do that).
for example: db.News.AddObject(N);
changes to db.News.Add(N);
and db.News.DeleteObject(N);
changes to db.News.Remove(N);
and db.DeleteObject(N);
changes to db.News.Remove(N);
Upvotes: 2