Templates replicating the functionality of the SQLMetal and the LINQ to SQL classes designer code-generators for both C# and VB.Net requiring just Visual Studio 2008.


Provide drop-in replacements that serve as a starting point for customized code generation. The templates also add:

- Can concurrency check when updating/deleting entities with stored procedures (switch on options.StoredProcedureConcurrency and have the SP return @@ROWCOUNT)
- Entity-per-file generation ability (does not rewrite unchanged files, cleans-up and checks out files that require changing automatically)
- DataContract serialization support for .NET 3.5 SP1 including KnownType & IsReference attributes
- Minor bug-fixes scheduled for inclusion in the .NET 4.0 release of SQLMetal/LINQ to SQL designer

Getting started

Follow these simple steps:
  1. Download either the last stable snapshot or the latest version in source control and extract the files
  2. Drag the L2ST4.ttinclude and either or files to your project
  3. Rename the .tt file to match your DBML file (retaining .tt instead of .dbml)
  4. Turn off the existing .generated file beneath the DBML (set it's Build Action property to None)

Remember to use Transform All Templates or Run Custom Tool on the .tt file to run the template when the DBML has changed (it's not automatic).


Templates are a work-in-progress and you should ensure the generated code is suitable for your application. Limitations include:

- Reserved keyword checking not implemented
- String escaping not implemented (e.g. " or CRLF in table/column names)

Last edited Feb 19, 2010 at 4:39 PM by damieng, version 21