views:

416

answers:

2

I use Linq2Sql and am tired of recreating the dbml everytime the database changes. Is it possible to script the creation of my model given that I want ALL tables and ALL procs? Ideally it would be part of the build process or a custom tool.

A simple "refresh from schema" button would be fine too, but from all I can tell, there is no such thing. Currently the only way I have to update my model is to delete the tables and procs that were changed and re-drag them over from the server explorer.

Maybe I'm missing something?

+3  A: 

I suppose you can use the SQLMetal command tool

EDIT by OP: I ended up writing a batch file to checkout the code, generate the classes with this, then commit the code. Then I created a database schema change level trigger to run this batch file anytime the schema changed. So now, when the schema changes, the Linq classes get created, checked in, then CCNet creates the DLL and distributes it. sweet......

Jose Basilio
A: 

If money is no object, your best bet is to get the data modeling edition of visual studio 2008 team system, create a database project and use it to maintain the database, data model and the entity model. It's not zero work to keep the database and the entity model synchronized, but using the schema compare tool, it's not far from it (and it definitely does all the drudge work for you).

IMHO, the data modeling and design roundtripping more than justifies the high cost of buying the team edition of Visual Studio 2008 over the professional edition.

Jeff Leonard