Friday, April 30, 2010

Not relying on Visual Studio dbml creator and using SQLMetal

For VS 2008: I like to keep all the data structure in the database (foreign key relationships etc.) and do not have much use of defining them manually in the dbml generated by Visual Studio. So I generally use a bat file like to following to generate the dbml file from the database (sql server compact example):

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SqlMetal.exe" ENDData.sdf /dbml:ENDData.dbml /serialization:unidirectional

This is for linq to SQL.

Now I use ADO.net entity framework so that I can use other non ms (free ;) ) databases. That has the update schema from database option which is cool.

Enjoy!

No comments:

Post a Comment