Attention: We are retiring the ASP.NET Community Blogs. Learn more >

LINQ in VS 2008 Having Problems to update tables or stored procedures from Database

 I decided to post this because I have tried to update my dbml file (LINQ2SQL) several times and I have forgotten the steps.

If I write this I should not forget it again. :)

For some reason LINQ2SQL has a bug in VS2008 (hope it will be fixed in VS2010) when you modify the dbml file and you have a partial class of the DataContext LINQ class with using statements the Custom tool that generates the code for LINQ class has a problem and  it doesn't generate the designer.cs file that contains the generated classes that you will be using in your pages or code.

Therefore these are the steps that I have followed with success

 1.- Modify the dbml with your changes.

2.- Comment the using statements in the partial class of the LINQ class

3.- Delete the designer.cs file

4.- Right Click the dbml file and select Run Custom Tool

5.- designer.cs is generated with the last changes in the dbml, make sure that designer.cs has a Build Action compile and not content.

6.- Rebuild your solution it should be compiled with new changes and ready to run the application.

 

Hope it helps, Happy Programming!!!

2 Comments

Comments have been disabled for this content.