I am new to LINQ. I am using Visual Studio 2008 and have created a “LINQ to SQL Classes” (.dbml) file in my project. I’ve added each of my database tables to the design view and everything works fine.
My question is this: When a change to a table’s design has been made in the database, i.e. fields added, how do you update the classes to reflect the changes? Do you have to delete the table from the dbml design view and drag it back onto the design view surface each time a table gets changed? It seems like there should be a better way, or that the table classes should dynamically update themselves with new fields added/removed. The table classes do not seem to notice/update/refresh the table changes on their own.
Thanks in advance for any advice you can offer!
There are a number of ways to deal with that. The built-in way is to edit manually, or to remove the affected tables from the diagram and re-add them, or to re-generate the entire DBML file with the designer or with SQLMetal. The drawback is that any customizations (changed class/property names etc) you may have done need to be re-done every time.
Alternatively, there are third-party add-ons that provide sync functionality. My company makes one of those tools, you can read more about it, download, and get a trial license at http://www.huagati.com/dbmltools/