Welcome to Bangladesh Microsoft Technology Community Sign in | Join | Help

Example SmartCodeGenerator: BusinessObjectGenerator

While browsing the internet I found this article “Business Object for CodeSmith” by JR Hull, this comes with some CodeSmith templates that generates object layer, data access layer, and related sql from a schema defined in the XML. I thought this will be a good and quick example to show for SCG where XML is concerned, I converted the templates to SCG templates and these are producing the same output.

These templates will generate ObjectLayer, DataAccess Layer and SQL for you.

To run the example quickly please point the XmlFilePath property to the "InvoiceClassDef.xml" that you will find with the sourcecode. The "Generated Files" folder contains the generated files from the following XML.

If this interest you then Download and have a look.....
:
<?xml version="1.0" encoding="utf-8" ?>
<BusinessObjects>
 <class name="Invoice"> 
     <properties>
  <property name="Id" type="String" maxSize="36" />
  <property name="Customer" type="String" maxSize="96" />
  <property name="InvoiceDate" type="DateTime" maxSize="" />
  <property name="InvoicePaid" type="bool" maxSize="" />
  <property name="InvoiceDetails" type="InvoiceDetailCollection" maxSize="" />
     </properties>
 </class>
 <class name="InvoiceDetail"> 
     <properties>
  <property name="Id" type="String" maxSize="36" />
  <property name="InvoiceId" type="String" maxSize="36" />
  <property name="LineItem" type="int" maxSize="" />
  <property name="ItemDescription" type="String" maxSize="96" />
  <property name="ItemCostPerUnit" type="decimal" maxSize="" />
  <property name="ItemQuanity" type="int" maxSize="" />
  <property name="ItemUnit" type="String" maxSize="8" />
     </properties>
 </class>
</BusinessObjects>

This example can be dowloaded from community.smartcodegenerator.com

Published Wednesday, April 25, 2007 3:09 AM by Shahed

Comments

No Comments

Anonymous comments are disabled