tags:

views:

572

answers:

5

is there a way i can refresh the dbml file or do i have to delete it and generate a whole new one?

A: 

It's usually quite a pain. Recompile, shut down VS, open it back up etc. It should work, but for me there was always a delay. It may be easier to manually create your model using LINQ though which is what I do. That way I've got full control over it.

Kezzer
A: 

I've heard of a trick where you create a new entity for your modified table and then drag/cut the new property from the new entity to your old one. Never tried it, however.

Will
+3  A: 

So far as I know there's no built-in functionality in the designer to update a table with changes in a database.

There are third party tools (http://www.huagati.com/dbmltools/) that offer that sort of functionality.

Whenever I ran into this issue it was on the order of one or two columns on a table with multiple manual relationships already set up, so I just edited the XML (right click on the DBML and select open with -> XML) and added the columns to the table definition.

JamesG
A: 

There's no mechanism to automatically refresh the DBML or to tell the DBML to re-read the database.

I believe the easiest way is to open the dbml file in the designer, delete the table and then re-add it to the design surface. Although this may depend on the complexity of the database, i.e. you may lose certain information.

I'd backup the dbml file first before trying :)

Kevin Jones
A: 

If you have made modifications to your model, droping the table and re-adding it may cause more problems than it's worth. In those cases, I would recommend manually modifying the designer (or dbml file). Don't touch the .Designer file as those changes will be overwritten.

Another alternative to consider is to use SqlMetal as part of your build process to regenerate the model from the database.

Jim Wooley