Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

code generation strategy to "default" in visual studio 2013

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?

like image 551
sanmis Avatar asked Oct 31 '22 11:10

sanmis


1 Answers

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);

like image 176
Sara NikitaUsefi Avatar answered Nov 13 '22 05:11

Sara NikitaUsefi