Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Code Smith


Published on

This is from an Intertech ( Presentation on Code Smith.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Code Smith

  1. 1. What is CodeSmith?<br />Template-based code generation tool<br />Reduces amount of repetitive work for developer(s)<br />Typically runs off metadata in a SQL Server or Access DB<br />© 2005 Intertech :: Confidential :: http:///<br />1<br />
  2. 2. CodeSmith Development<br />Script can be written in C#, VB.NET or JScript.NET languages <br />Output can be any ASCII based language (.NET code, HTML, etc)<br />Syntax is nearly identical to ASP.NET - you’ll recognize the script blocks (&lt;% %&gt;), template properties and &lt;script&gt; blocks. <br />© 2005 Intertech :: Proprietary and Confidential ::<br />2<br />
  3. 3. CodeSmith IDE<br />© 2005 Intertech :: Proprietary and Confidential ::<br />3<br /><ul><li> CodeSmith IDE looks very similar to Visual Studio IDE</li></li></ul><li>Template Explorer and Execution<br />Template Explorer shows sandbox of templates<br />Executing each template (.cst) file will output code for that template <br />Usually helpful to have a master file that contains the logic and iterative loops to generate all object classes<br />© 2005 Intertech :: Proprietary and Confidential ::<br />4<br />
  4. 4. SchemaExplorer<br />SchemaExplorer uses the provider pattern to allow for schema information to be discovered from various sources.<br />To customized this for your needs, implement SchemaExplorer.IDbSchemaProviderand put custom .DLL in the CodeSmith runtime directory.<br />This allows for generation of:<br />Typed datasets<br />Biz objects<br />Stored procedure wrappers<br />Presentation layer code<br />© 2005 Intertech :: Proprietary and Confidential ::<br />5<br />
  5. 5. Debugging<br />Debugging is the weakest area of CodeSmith - still a bit primitive<br />Setting breakpoints in IDE are not supported yet<br />Compile in DEBUG mode by setting debug directive = TRUE<br />&lt;%@ CodeTemplate Language=&quot;C#&quot; TargetLanguage=&quot;C#&quot; Description=&quot;Debugging your template&quot; Debug=&quot;true&quot; %&gt;     <br />Enter&lt;% Debugger.Break() %&gt; statement in the script code<br />When execution gets to break statement, user is prompted to start the Visual Studio .NET CLR debugger<br />© 2005 Intertech :: Proprietary and Confidential ::<br />6<br />
  6. 6. Steps for Typical Usage<br />Day-to-day changes:<br />Do your updates to either metadata or template/code changes<br />Run CodeSmith templates to generate new code (output to temp dir)<br />Merge updated files into existing projects – don’t want to overwrite any custom developer code when merging.<br /><ul><li>BeyondCompare is a good tool for this</li></ul>Compile existing projects to make sure syntax & output is correct.<br />At Agribank, we use CodeSmith for generating:<br />Schema classes<br />Biz objects<br />Stored proc wrappers<br />© 2005 Intertech :: Proprietary and Confidential ::<br />7<br />
  7. 7. New Features in CodeSmith 3.0<br />IntelliSense<br />Improved debugging features – line numbers for compiler errors<br />Faster compiling & caching – improved performance<br />Merge capabilities – integrated merge utility<br />Console client enhancements – now includes a “batch mode” to be used standalone or as part of an automated build process<br />Not FREE anymore –$49 for Standard, $299 for Professional<br />© 2005 Intertech :: Proprietary and Confidential ::<br />8<br />
  8. 8. Review<br />More Information:<br />CodeSmith current version (v2.6) home page<br /><br />New web site for CodeSmith 3.0 RC1<br /><br />BeyondCompare diff/merge utility<br /><br />Review<br />Q & A<br />© 2005 Intertech :: Proprietary and Confidential ::<br />9<br />