Summary
SqlMetalPlus 1.0. Of changes to the DBML file SqlMetal generates, such. Same folder as the DBML file with a name as DBML file name 'custom.xml'.So, if your. It just creates a copy of DBML file and changes the file name. Apply Customization: This command applies the custom changes to the existing DBML file. Create/Refresh: This command either creates the initial DBML (or) refreshes the complete DBML with the latest changes from the selected database and then applies the custom changes.
T4 templates with the functionality of SQLMetal/LINQ to SQL classes designer code-generators for C# & VB.Net.
Goal
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:
- Download the latest release and extract the files
- Drag the L2ST4.ttinclude and either CSharpDataClasses.tt or VBNetDataClasses.tt files to your project
- Rename the .tt file to match your DBML file (retaining .tt instead of .dbml)
- 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). If your .tt file does not have the Custom Tool property defined then set it to
TextTemplatingFileGenerator
.Limitations
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)
- Tables with CRLF or ' in the name break code generation
- Escaping a column or table name with [] but not the association reference causes lookup failure
Active5 years, 8 months ago
In Visual Studio, when working with Entity Framework and applying Run Custom Tool for .tt and .Context.tt files, What is it and what does it do?
Why it's solving database sync-problems (Sometimes)? and why i should run it for (.tt) before run it for (.Context.tt)?
Alaa
AlaaAlaa
5,39115 gold badges46 silver badges81 bronze badges
1 Answer
It's called 'Text Template Transformation Toolkit' and you can use it to create classes out of a meta description (for example). EF uses it to create the classes (context and entity classes) out of the model.
You can also look at http://en.wikipedia.org/wiki/Text_Template_Transformation_Toolkit
You can create your own template and have them run. We used it to create an enumeration of of a database table once. More convienient than to do that manually. Later this was deprecated because EF has gained support for enumerations.
SaschaSaschaCustom Tool Trailers
8,9493 gold badges34 silver badges58 bronze badges
Great Lakes Custom Tool
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.