DLinq and SqlMetal
One of the problems I am always having with database development is the gap between data and code. Sure it isn’t hard to move data from database to memory, manipulate it and move it back but what remains a drag is someone making schema changes to the database and only finding out at runtime that the classes no longer match the underlying database schema.
Well there might me light at the end of the tunnel :-)
One of the features of DLinq is a command line utility called SqlMetal. Using this tool you can generate the types required for DLinq to work. Basically it generates a large source file, depending on the command line parameters, that you can include in your project. Now suppose you add this command line utility to the Visual Studio projects pre-build event? This way you will always have an up to date set of entity objects matching the database schema and you will get compile errors as soon as you change the database schema.
Update: See
http://msmvps.com/blogs/theproblemsolver/archive/2006/05/30/97708.aspx for an example.
Maurice de Beijer
www.TheProblemSolver.nl