<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.codesmithtools.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Paul Welter</title><link>http://community.codesmithtools.com/blogs/pwelter/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>PLINQO - CodeSmith LINQ to SQL Templates</title><link>http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/10/plinqo-codesmith-linq-to-sql-templates.aspx</link><pubDate>Fri, 10 Aug 2007 17:36:00 GMT</pubDate><guid isPermaLink="false">829aebef-9208-4531-832e-1f916c1e97cb:27050</guid><dc:creator>Paul Welter's Weblog : CodeSmith</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.codesmithtools.com/blogs/pwelter/rsscomments.aspx?PostID=27050</wfw:commentRss><comments>http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/10/plinqo-codesmith-linq-to-sql-templates.aspx#comments</comments><description>PLINQO, which stands for Professional LINQ to Objects, is a collection of CodeSmith templates that are meant to replace and extend the LINQ to SQL designers that are included with Visual Studio 2008. Features Generate or update a LINQ to SQL dbml file...(&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/10/plinqo-codesmith-linq-to-sql-templates.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://community.codesmithtools.com/aggbug.aspx?PostID=27050" width="1" height="1"&gt;</description><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/CodeSmith/default.aspx">CodeSmith</category><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/Linq/default.aspx">Linq</category><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/.net/default.aspx">.net</category></item><item><title>PLINQO - Supercharge LINQ to SQL</title><link>http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/08/plinqo.aspx</link><pubDate>Wed, 08 Aug 2007 17:57:00 GMT</pubDate><guid isPermaLink="false">829aebef-9208-4531-832e-1f916c1e97cb:26925</guid><dc:creator>pwelter34</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.codesmithtools.com/blogs/pwelter/rsscomments.aspx?PostID=26925</wfw:commentRss><comments>http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/08/plinqo.aspx#comments</comments><description>&lt;h1&gt;Table of Contents&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Overview"&gt;Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Features"&gt;Features&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#QuickStart"&gt;Quick Start&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Dbml.cst"&gt;Dbml.cst Template&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Entities.cst"&gt;Entities.cst Template&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Managers.cst"&gt;Managers.cst Template&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#KnownIssues"&gt;Known Issues&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Roadmap"&gt;Roadmap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2007/08/03/plinqo.aspx#Download"&gt;Download&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;&lt;a class="" title="Overview" name="Overview"&gt;&lt;/a&gt;Overview&lt;/h2&gt;
&lt;p&gt;PLINQO, which stands for Professional LINQ to Objects, is a collection of CodeSmith templates that are meant to replace and extend the LINQ to SQL designers that are included with Visual Studio 2008.&lt;/p&gt;
&lt;h2&gt;&lt;a class="" title="Features" name="Features"&gt;&lt;/a&gt;Features&lt;/h2&gt;
&lt;p&gt;The templates have the following features.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Generate or update a LINQ to SQL dbml file from a database schema. 
&lt;ul&gt;
&lt;li&gt;Includes all tables, stored procedures, functions, and views with the ability to exclude objects based on regex patterns.&lt;/li&gt;
&lt;li&gt;Ability to automatically remove object prefix and suffixes (ie. tbl_ and usp_).&lt;/li&gt;
&lt;li&gt;Dbml file can still be customized with the normal Visual Studio 2008 designer.&lt;/li&gt;
&lt;li&gt;Dbml file can be refreshed based on the current database schema without losing customizations. &lt;i&gt;(See Safe Attributes)&lt;/i&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Generation of the LINQ to SQL DataContext class.&lt;/li&gt;
&lt;li&gt;Generation of the LINQ to SQL entity classes. 
&lt;ul&gt;
&lt;li&gt;Generates one file per entity instead of one massive file.&lt;/li&gt;
&lt;li&gt;Generates partial classes where custom code can be written and won&amp;#39;t be overwritten.&lt;/li&gt;
&lt;li&gt;Generated entity files are added to the project as code behind files to their corresponding custom entity files.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Generation of entity manager classes. 
&lt;ul&gt;
&lt;li&gt;Adds customizable business rules engine to enforce entity validation, business and security rules.&lt;/li&gt;
&lt;li&gt;Provides access to common queries based on primary keys, foreign keys, and indexes.&lt;/li&gt;
&lt;li&gt;Common queries are exposed as IQueryable so they can be extended.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;All templates can be customized to meet your needs.&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;&lt;a class="" title="QuickStart" name="QuickStart"&gt;&lt;/a&gt;Quick Start&lt;/h2&gt;
&lt;p&gt;Use the following steps to get started using the Linq to Sql templates.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new Class Library project in Visual Studio 2008.&lt;/li&gt;
&lt;li&gt;Add a new CodeSmith project file to the Visual Studio project. (Figure 1)&lt;br /&gt;&lt;img title="Figure 1 - Sample Solution" height="239" alt="Figure 1 - Sample Solution" src="http://community.codesmithtools.com/photos/tutorials/images/26924/original.aspx" width="222" /&gt;&lt;/li&gt;
&lt;li&gt;Add a new Output to the project file for the &lt;a href="http://community.codesmithtools.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=47&amp;amp;postid=26925#Dbml.cst"&gt;Dbml.cst&lt;/a&gt; template. (Figure 2)&lt;br /&gt;&lt;img title="Figure 2 - Add Dbml Output" alt="Figure 2 - Add Dbml Output" src="http://community.codesmithtools.com/photos/tutorials/images/26919/500x375.aspx" /&gt;&lt;/li&gt;
&lt;li&gt;Add another Output to the project file for the &lt;a href="http://community.codesmithtools.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=47&amp;amp;postid=26925#Entities.cst"&gt;Entities.cst&lt;/a&gt; template. (Figure 3)&lt;br /&gt;&lt;img title="Figure 3 - Add Entities Output" alt="Figure 3 - Add Entities Output" src="http://community.codesmithtools.com/photos/tutorials/images/26920/500x375.aspx" /&gt;&lt;/li&gt;
&lt;li&gt;Optionally, Add an Output for the &lt;a href="http://community.codesmithtools.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=47&amp;amp;postid=26925#Managers.cst"&gt;Managers.cst&lt;/a&gt; template. (Figure 4)&lt;br /&gt;&lt;img title="Figure 4 - Add Managers Output" alt="Figure 4 - Add Managers Output" src="http://community.codesmithtools.com/photos/tutorials/images/26922/500x375.aspx" /&gt;&lt;/li&gt;
&lt;li&gt;Set the &lt;i&gt;Sample.csp -&amp;gt; Output Options -&amp;gt; Add Outputs&lt;/i&gt; to Project to unchecked.&amp;nbsp; The templates update the project for you.&lt;/li&gt;
&lt;li&gt;Finally, Generate the Outputs. (Figure 5)&lt;br /&gt;&lt;img title="Figure 5 - Sample Generated" height="343" alt="Figure 5 - Sample Generated" src="http://community.codesmithtools.com/photos/tutorials/images/26923/original.aspx" width="213" /&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;h2&gt;&lt;a class="" title="Dbml.cst" name="Dbml.cst"&gt;&lt;/a&gt;Dbml.cst Template&lt;/h2&gt;
&lt;p&gt;The Dbml.cst template is used to create a LINQ to SQL dbml file.&amp;nbsp; The file conforms to the Microsoft DbmlSchema.xsd schema.&amp;nbsp; This is the same document that the LINQ to SQL designer uses.&amp;nbsp; The generated dbml file from this template can also be edited from the LINQ to SQL designer.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;The template will create a new file if it doesn&amp;#39;t exist.&amp;nbsp; If the file does exist, the template will read it in and update it.&amp;nbsp; This allows you to make changes to the file and not have it overwrite if the template is re-ran.&amp;nbsp; However, only some of the attributes are safe from overwriting.&amp;nbsp; Here is a list of safe attributes.&amp;nbsp; They will be listed as an xpath.&lt;/p&gt;
&lt;p&gt;Safe Attributes to change in the Dbml file ...&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Database/@Class - The name of the DataContext class that will be generated.&lt;/li&gt;
&lt;li&gt;Database/@EntityNamespace - The namespace for the entity classes.&lt;/li&gt;
&lt;li&gt;Database/@ContextNamespace - The namespace for the DataContext class.&lt;/li&gt;
&lt;li&gt;Table/@Member - The property name for the table in the DataContext class.&lt;/li&gt;
&lt;li&gt;Type/@Name - The name of the entity class.&lt;/li&gt;
&lt;li&gt;Column/@Member - The property name for the column in the entity class.&lt;/li&gt;
&lt;li&gt;Column/@Storage - The private field LINQ to SQL will us to assign values to.&lt;/li&gt;
&lt;li&gt;Association/@Member - The property name for this association.&lt;/li&gt;
&lt;li&gt;Association/@Storage - The private field LINQ to SQL will us to assign values the association to.&lt;/li&gt;
&lt;li&gt;Function/@Method&amp;nbsp; - The name of the method for the database procedure.&lt;/li&gt;
&lt;li&gt;Parameter/@Parameter - The method argument name that maps to the database procedure parameter.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Warning:&lt;/b&gt; Be aware that the template will drop tables, columns and associations that it did not find in the database.&lt;/p&gt;
&lt;p&gt;Properties on the Dbml.cst template:&lt;/p&gt;
&lt;table class="" cellpadding="4"&gt;

&lt;tr&gt;
&lt;th class=""&gt;Property&lt;/th&gt;
&lt;th class=""&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;CleanExpression&lt;/td&gt;
&lt;td class=""&gt;List of regular expressions to clean table, view, column and procedure names.&amp;nbsp; Any matched text found will be removed from the name.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;IgnoreList&lt;/td&gt;
&lt;td class=""&gt;List of regular expressions used to ignore tables, views and procedures when generating mapping.&amp;nbsp; Any database objects that match one of these regular expressions will be ignored.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;IncludeFunctions&lt;/td&gt;
&lt;td class=""&gt;Include stored procedures and user functions in mapping.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;IncludeViews&lt;/td&gt;
&lt;td class=""&gt;Include views in mapping.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;SourceDatabase&lt;/td&gt;
&lt;td class=""&gt;The source database to generate the dbml file for.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ContextNamespace&lt;/td&gt;
&lt;td class=""&gt;The namespace to use for the context class file.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;EntityNamespace&lt;/td&gt;
&lt;td class=""&gt;The namespace to use for the entity class files.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;DbmlFile&lt;/td&gt;
&lt;td class=""&gt;The path to the dbml file to generate.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;h2&gt;&lt;a class="" title="Entities.cst" name="Entities.cst"&gt;&lt;/a&gt;Entities.cst Template&lt;/h2&gt;
&lt;p&gt;The entities template generates the entity classes needed by LINQ.&amp;nbsp; The classes are generated from a dbml file.&amp;nbsp; You can modify the names for classes and properties by editing the dbml file.&amp;nbsp; See &lt;a href="http://community.codesmithtools.com/controlpanel/blogs/posteditor.aspx?SelectedNavItem=Posts&amp;amp;sectionid=47&amp;amp;postid=26925#Dbml.cst"&gt;Dbml.cst&lt;/a&gt; for a list of safe attributes to change in the dbml file.&lt;/p&gt;
&lt;p&gt;The template will generate 2 files for every Type in the dbml file.&amp;nbsp; One file will be the generated partial class that can not be changed as it is overwritten when the template is re-ran.&amp;nbsp; It will have the following file name... &amp;lt;entity&amp;gt;.Generated.cs&lt;/p&gt;
&lt;p&gt;The second file is a partial class that can be modified as it will not be re-generated.&amp;nbsp; You can implement the partial methods in this file.&amp;nbsp; Some partial method stubs are created by default. This file will be named... &amp;lt;entity&amp;gt;.cs&lt;/p&gt;
&lt;p&gt;If you set the project file property on the template, the generated files will be added to the project.&amp;nbsp; The file that can not be modified will be hidden under the file that can be changed.&lt;/p&gt;
&lt;p&gt;Properties on the Entities.cst template:&lt;/p&gt;
&lt;table class="" cellpadding="4"&gt;

&lt;tr&gt;
&lt;th class=""&gt;Property&lt;/th&gt;
&lt;th class=""&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;DbmlFile&lt;/td&gt;
&lt;td class=""&gt;The path to the dbml file used generate the entities from.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;OutputDirectory&lt;/td&gt;
&lt;td class=""&gt;The folder to save the generated files.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ProjectFile&lt;/td&gt;
&lt;td class=""&gt;The Visual Studio project file to add the generated files to.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;h2&gt;&lt;a class="" title="Managers.cst" name="Managers.cst"&gt;&lt;/a&gt;Managers.cst Template&lt;/h2&gt;
&lt;p&gt;The manager template is for helping you get started with business logic for the LINQ entities.&amp;nbsp; The managers will have common queries that are created from keys and indexes on the table.&amp;nbsp; The manager will also have rules for the entity properties to make sure required fields are not null and that the length of a string does not exceed the max length the column allows.&lt;/p&gt;
&lt;p&gt;The template works by creating a second DataContext class that has a Manager property.&amp;nbsp; The manager will then have a property for each entity that has a manager. Here is a sample of the syntax for using the managers:&lt;/p&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white 0% 50%;COLOR:black;FONT-FAMILY:Courier New;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span&gt;SampleManagerContext&lt;/span&gt; db = &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span&gt;SampleManagerContext&lt;/span&gt;();&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:green;"&gt;// use the primary key&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span&gt;Task&lt;/span&gt; task = db.Manager.Task.GetByTaskID(taskId);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:green;"&gt;// use a foreign key&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; myTasks = db.Manager.Task.GetByAssignedID(userId);&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:green;"&gt;// the methods return IQueryable so you can add expressions&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;var&lt;/span&gt; openTasks = db.Manager.Task.GetByStatusID(statusId).OrderBy(t =&amp;gt; t.CreateDate);&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;The manager also provides a business rules engine to your entities. In addition to the default validation rules that are generated, you can add custom rules by implementing the AddRules partial method in the custom entity class.&lt;/p&gt;
&lt;div style="FONT-SIZE:10pt;BACKGROUND:white 0% 50%;COLOR:black;FONT-FAMILY:Courier New;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;
&lt;p style="MARGIN:0px;"&gt;&lt;span style="COLOR:blue;"&gt;static&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;partial&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;void&lt;/span&gt; AddRules()&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;{&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:green;"&gt;// Rule allows the Name property to be a max of 150 characters.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RuleManager.AddShared&amp;lt;&lt;span&gt;Task&lt;/span&gt;&amp;gt;(&lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; LengthRule(&lt;span&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, 150));&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:green;"&gt;// Rule that validates the value of the property using regex.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RuleManager.AddShared&amp;lt;&lt;span&gt;Task&lt;/span&gt;&amp;gt;(&lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; RegexRule(&lt;span&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;, &lt;span&gt;&amp;quot;.*&amp;quot;&lt;/span&gt;));&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:green;"&gt;// Rule allows only users in certain security roles to update.&lt;/span&gt;&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; RuleManager.AddShared&amp;lt;&lt;span&gt;Task&lt;/span&gt;&amp;gt;(&lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; UpdateRule(&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="COLOR:blue;"&gt;new&lt;/span&gt; &lt;span style="COLOR:blue;"&gt;string&lt;/span&gt;[] { &lt;span&gt;&amp;quot;Administrator&amp;quot;&lt;/span&gt;, &lt;span&gt;&amp;quot;Updaters&amp;quot;&lt;/span&gt; }));&lt;/p&gt;
&lt;p style="MARGIN:0px;"&gt;}&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Properties on the Managers.cst template:&lt;/p&gt;
&lt;table class="" cellpadding="4"&gt;

&lt;tr&gt;
&lt;th class=""&gt;Property&lt;/th&gt;
&lt;th class=""&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;SourceDatabase&lt;/td&gt;
&lt;td class=""&gt;The source database to keys and indexes from for generating the manager classes.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;DbmlFile&lt;/td&gt;
&lt;td class=""&gt;The path to the dbml file used generate the manager classes from.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ManagerContextName&lt;/td&gt;
&lt;td class=""&gt;The class name of the DataContext that supports the managers.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ManagerDirectory&lt;/td&gt;
&lt;td class=""&gt;The folder to save the generated manager files.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ManagerNamespace&lt;/td&gt;
&lt;td class=""&gt;The namespace to use for the generated manager class files.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=""&gt;ProjectFile&lt;/td&gt;
&lt;td class=""&gt;The Visual Studio project file to add the generated files to.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;h2&gt;&lt;a class="" title="KnownIssues" name="KnownIssues"&gt;&lt;/a&gt;Known Issues&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;The generated DataContext does not set the connection string like the LINQ to SQL designer&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;&lt;a class="" title="Roadmap" name="Roadmap"&gt;&lt;/a&gt;Roadmap&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Improve manager template&lt;/li&gt;
&lt;li&gt;Unit test generation&lt;/li&gt;
&lt;li&gt;Web service generation&lt;/li&gt;
&lt;li&gt;ASP.NET, Winforms and WPF UI generation&lt;/li&gt;
&lt;li&gt;Visual Basic support&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;&lt;a class="" title="Download" name="Download"&gt;&lt;/a&gt;Download&lt;/h2&gt;
&lt;p&gt;Download the latest release from CodePlex.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/codesmith/Release/ProjectReleases.aspx"&gt;http://www.codeplex.com/codesmith/Release/ProjectReleases.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://community.codesmithtools.com/aggbug.aspx?PostID=26925" width="1" height="1"&gt;</description><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/Plinqo/default.aspx">Plinqo</category><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/Linq/default.aspx">Linq</category></item><item><title>Introduction to CodeSmith Project Files</title><link>http://community.codesmithtools.com/blogs/pwelter/archive/2007/06/10/introduction-to-codesmith-project-files.aspx</link><pubDate>Sun, 10 Jun 2007 05:38:00 GMT</pubDate><guid isPermaLink="false">829aebef-9208-4531-832e-1f916c1e97cb:25111</guid><dc:creator>shannon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.codesmithtools.com/blogs/pwelter/rsscomments.aspx?PostID=25111</wfw:commentRss><comments>http://community.codesmithtools.com/blogs/pwelter/archive/2007/06/10/introduction-to-codesmith-project-files.aspx#comments</comments><description>&lt;h1&gt;Introduction to CodeSmith Project Files&lt;/h1&gt;
&lt;h2&gt;&lt;img title="Mapping File Settings" style="FLOAT:right;" height="342" alt="Mapping File Settings" hspace="10" src="http://community.codesmithtools.com/photos/tutorials/images/21687/original.aspx" width="337" /&gt;Overview&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;A new feature in CodeSmith 4.0 is the ability to manage groups of CodeSmith templates and their outputs with a single file called a CodeSmith Project. CodeSmith Projects enable you to define and run an entire code generation process quickly and easily using the environment of your choice. They were designed with flexibility in mind to let you define the way you work.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;This introduction will show how to use a csp (CodeSmith project) to organize your code generation in a development environment. The example will use the sample Wilson ORMapper templates that are included in CodeSmith.&amp;nbsp; To use the generated code, a copy of the &lt;a href="http://www.ormapper.com/"&gt;Wilson ORMapper&lt;/a&gt; is needed. &lt;/p&gt;
&lt;h2&gt;Creating the CodeSmith Project File&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;The ORMapper templates are split into three separate groups of templates.&amp;nbsp; The first set of templates is the MappingFile.cst.&amp;nbsp; Use this template to start out your csp. &lt;/p&gt;
&lt;p class="MsoNormal"&gt;The first step is to&amp;nbsp; load up CodeSmith and select the Mapping.cst template. Set the properties as needed.&amp;nbsp; This example will use the sample Petshop database that comes with CodeSmith.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Once you have the properties values set, click the Save icon.&amp;nbsp; This will create the start of a csp file.&lt;/p&gt;
&lt;h2&gt;Managing the CodeSmith Project File&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;Now use the Explorer context menu on the csp file and choose Manage Outputs.&amp;nbsp; In the manage outputs dialog, add the second template that is need for the ORMapper.&amp;nbsp; For this example, add the CSharp.ClassGenerator.cst template.&amp;nbsp; Set the properties values for the template and click ok to close the dialogs.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;img title="Manage Outputs" height="350" alt="Manage Outputs" src="http://community.codesmithtools.com/photos/tutorials/images/21690/original.aspx" width="450" /&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;img title="Add Template to Project" height="428" alt="Add Template to Project" src="http://community.codesmithtools.com/photos/tutorials/images/21688/original.aspx" width="608" /&gt;&lt;/p&gt;
&lt;h2&gt;Generating with a CodeSmith Project&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;Now the csp file has been created, it can be used to generate code.&amp;nbsp; There are several ways to generate with the project file, see &lt;a href="http://www.codesmithtools.com/usersguide/Using%20_a_CodeSmith_Project_to_Generate_Anywhere.html"&gt;Using a CodeSmith Project to Generate Anywhere&lt;/a&gt; in the User&amp;#39;s Guide. &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;img title="Generate Code" height="291" alt="Generate Code" src="http://community.codesmithtools.com/photos/tutorials/images/21689/original.aspx" width="453" /&gt;&lt;/p&gt;
&lt;h2&gt;&lt;img title="CodeSmith Project in Visual Studio" style="FLOAT:right;" height="509" alt="CodeSmith Project in Visual Studio" hspace="10" src="http://community.codesmithtools.com/photos/tutorials/images/21691/original.aspx" width="293" /&gt;Visual Studio and CodeSmith Project Files&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;CodeSmith 4.0 has a new Visual Studio addin that allows you to use a csp right in Visual Studio, see &lt;a href="http://www.codesmithtools.com/usersguide/Using_a_CSP_from_Visual_Studio.html"&gt;Using a CodeSmith Project inside Visual Studio&lt;/a&gt; in the User&amp;#39;s Guide.&amp;nbsp; Including the csp file in Visual Studio will help to keep the project clean and make it much easier to re-generate code when needed.&amp;nbsp; The csp file can be added to the solution as a Solution Item or to a project directly.&amp;nbsp; When the csp is added to a C# or VB project, more options are available, including adding the outputs to the project.&amp;nbsp; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;In the example above, the created Petshop.csp file can be added a Petshop Visual Studio solution.&amp;nbsp; Now, any time there is database change, the Petshop.csp file can regenerate the ORMapped class files savings a ton of time.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p class="MsoNormal"&gt;The CodeSmith Project feature makes automating your code generation process really easy and consistent whether you are working from inside of Visual Studio 2005, MSBuild, Windows Explorer, a command line / batch file, or CodeSmith itself. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://community.codesmithtools.com/aggbug.aspx?PostID=25111" width="1" height="1"&gt;</description><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/CodeSmith+4.0/default.aspx">CodeSmith 4.0</category><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/Tips+_2600_amp_3B00_+Tricks/default.aspx">Tips &amp;amp; Tricks</category></item><item><title>Tips &amp; Tricks: Debugging</title><link>http://community.codesmithtools.com/blogs/pwelter/archive/2007/06/09/tips-amp-tricks-debugging.aspx</link><pubDate>Sun, 10 Jun 2007 04:03:00 GMT</pubDate><guid isPermaLink="false">829aebef-9208-4531-832e-1f916c1e97cb:25108</guid><dc:creator>shannon</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.codesmithtools.com/blogs/pwelter/rsscomments.aspx?PostID=25108</wfw:commentRss><comments>http://community.codesmithtools.com/blogs/pwelter/archive/2007/06/09/tips-amp-tricks-debugging.aspx#comments</comments><description>&lt;h3&gt;Overview &lt;/h3&gt;
&lt;p&gt;CodeSmith supports debugging by using the CLR&amp;#39;s Just-in-Time debugger.&amp;nbsp; This article will show some tips and tricks in setting up CodeSmith templates to use the debugger.&lt;/p&gt;
&lt;h3&gt;Allow Debugging in Template&lt;/h3&gt;
&lt;p&gt;The first step to allow debugging a template is to set the Debug attribute on the &lt;a href="http://www.codesmithtools.com/usersguide/The_CodeTemplate_Directive.html"&gt;CodeTemplate declarative&lt;/a&gt; to true.&lt;/p&gt;&lt;pre&gt;&amp;lt;%@ CodeTemplate Language=&amp;quot;C#&amp;quot; TargetLanguage=&amp;quot;C#&amp;quot; Debug=&amp;quot;True&amp;quot; %&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;h3&gt;Setting a Break Point&lt;/h3&gt;
&lt;p&gt;In order to get the Just-in-Time debugger to load and stop at a point in your code, you need to use the Debugger.Break() statement.&lt;/p&gt;&lt;pre&gt;Debugger.Break();&lt;/pre&gt;
&lt;p&gt;If you are setting a break point in a code behind file or included class, you need to include the namespace for the debugger class.&lt;/p&gt;&lt;pre&gt;System.Diagnostics.Debugger.Break();&lt;/pre&gt;
&lt;h3&gt;Using the Debugger&lt;/h3&gt;
&lt;p&gt;When you execute a template in CodeSmith Studio and it encounters a break point, you will see the following dialogs.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://community.codesmithtools.com/photos/tutorials/images/23945/original.aspx" target="_blank"&gt;&lt;img src="http://community.codesmithtools.com/photos/tutorials/images/23945/425x154.aspx" title="User Defined Break Point" alt="User Defined Break Point" border="0" width="425" height="154" /&gt;&lt;/a&gt; &lt;br /&gt;When you see the user-defined breakpoint dialog, choose Debug.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://community.codesmithtools.com/photos/tutorials/images/23946/original.aspx" target="_blank"&gt;&lt;img src="http://community.codesmithtools.com/photos/tutorials/images/23946/393x425.aspx" title="Just-In-Time Debugger" alt="Just-In-Time Debugger" border="0" width="393" height="425" /&gt;&lt;/a&gt;&lt;br /&gt;Choose the Debugger you want to use.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://community.codesmithtools.com/photos/tutorials/images/23947/original.aspx" target="_blank"&gt;&lt;img src="http://community.codesmithtools.com/photos/tutorials/images/23947/425x317.aspx" title="Microsoft CLR Debugger" alt="Microsoft CLR Debugger" border="0" width="425" height="317" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Debugging in Windows Vista&lt;/h3&gt;
&lt;p&gt;There are some problems with using the Just-In-Time debugger in Windows Vista.&amp;nbsp; First you need to make sure you have all the latest service packs installed. Next, the debugger in Vista will cause CodeSmith to hang when you finish debugging.&amp;nbsp; You can work around this issue by updating the Just-In-Time debugger setting DbgJITDebugLaunchSetting.&amp;nbsp; The setting is found in the registry at [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework].&amp;nbsp; Change the value of DbgJITDebugLaunchSetting to 2.&amp;nbsp; This will cause the debugger dialog to be displayed immediately when your code hits a breakpoint.&amp;nbsp; This will also allow control to return to CodeSmith when you continue the execution of the template from the debugger.&lt;/p&gt;
&lt;h3&gt;Troubleshooting &lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If you are having trouble with the debugger, try using the CLR debugger as that tends to work better.&lt;/li&gt;&lt;li&gt;If you are getting the message, &amp;quot;There is no source code available for the current location.&amp;quot;, you need to change the default editor for .cst files in Visual Studio to be the &amp;quot;Source Code (Text) Editor&amp;quot;. &lt;/li&gt;
&lt;li&gt;If you are having further issues in Vista, make sure to run CodeSmith with full administrator rights by right clicking and choose run as administrator.&lt;/li&gt;&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://community.codesmithtools.com/aggbug.aspx?PostID=25108" width="1" height="1"&gt;</description><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/CodeSmith+4.0/default.aspx">CodeSmith 4.0</category><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/Tips+_2600_amp_3B00_+Tricks/default.aspx">Tips &amp;amp; Tricks</category></item><item><title>CodeSmith 4.0 Public Beta Released</title><link>http://community.codesmithtools.com/blogs/pwelter/archive/2006/10/19/codesmith-4-0-public-beta-released.aspx</link><pubDate>Thu, 19 Oct 2006 16:24:00 GMT</pubDate><guid isPermaLink="false">829aebef-9208-4531-832e-1f916c1e97cb:25053</guid><dc:creator>Paul Welter&amp;#39;s Weblog : CodeSmith</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://community.codesmithtools.com/blogs/pwelter/rsscomments.aspx?PostID=25053</wfw:commentRss><comments>http://community.codesmithtools.com/blogs/pwelter/archive/2006/10/19/codesmith-4-0-public-beta-released.aspx#comments</comments><description>CodeSmith 4.0 Beta 2 has been released and is now available to the public. Here are just a few the new capabilities in CodeSmith 4.0: CodeSmith Projects (.csp) - This feature makes automating your code generation process really easy and consistent whether...(&lt;a href="http://community.codesmithtools.com/blogs/pwelter/archive/2006/10/19/codesmith-4-0-public-beta-released.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://community.codesmithtools.com/aggbug.aspx?PostID=25053" width="1" height="1"&gt;</description><category domain="http://community.codesmithtools.com/blogs/pwelter/archive/tags/CodeSmith/default.aspx">CodeSmith</category></item></channel></rss>