Regenerating DBML Designer when your database changes

Here’s how to regenerate your DBML code in Visual Studio 2010 when one of your database objects changes:
1. Remove the table
2. Close the DBML designer and save
3. Re-open the DBML designer
4. Re-add the object by dragging from Server Explorer
5. Close the DBML designer and save

In finding this solution, I did find some wailing and gnashing of teeth on-line, with people expecting the DBML code to have some kind of refresh feature for automatically doing this when the database changed.

I must admit I don’t share their chagrin. I am:
* Pathetically grateful for anything that saves me not having to write a hundred lines of property let/get statements
* Impressed by the way projects that reference these objects automatically re-test for compilation as soon as you save the DBML code

Leave a Reply

Your email address will not be published. Required fields are marked *