Templated code gen for LINQ to SQL


This is going to be a brief one. If you are using LINQ to SQL, you should check out Damien’s new templated code generator sample. One of our regrets from LINQ to SQL V1 days was not providing an easy way to tailor the code-gen. This is one step in that direction.


 Another major step would be to preserve “excluded” tables/columns/sprocs/… in dbml. So any change in schema can be handled appropriately as new/deleted database object (a rename could be treated as a removed column and an added column from metadata perspective).


 Dinesh


 


Comments (2)

  1. Kodeo says:

    Reegenerator (<a href="http://www.reegenerator.com">http://www.reegenerator.com</a&gt;) allows you to customize the code generated by the LINQtoSQL designer. You will still be using the default designer but you can have full control over the generated code.  Watch how to do it at http://www.reegenerator.com/ShowVideo.htm?video=Replace.swf

    The video shows you how easy it is to start building a LINQtoSQL code generator that gets invoked by the LINQtoSQL default designer.

    You can download the code generators at http://www.reegenerator.com/TemplatesGallery.htm. This page gives you replacements for LINQtoSQL, Dataset, Resources and Settings designers (C# and VB). All the renderers emulate the default behaviour in order to offer you a familiar starting point for any customization you want to implement.

    If your customizations are minimal, you can invoke the default code generator, capture the results as a string, modify them as you like and return the modified results to Visual Studio to be saved in the .Designer.cs file.

Skip to main content