posts - 217, comments - 218, trackbacks - 239

My Links

News




I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net) and born in Bangladesh.
I work for Ocean Informatics Pty Ltd as a Senior Developer - Analyst.
I am also co-founder and core developer of Pageflakes (acquired by LiveUniverse) www.pageflakes.com
and most recently created SmartCodeGenerator

My Articles
Flexible and Plugin based .Net Application..
Mass Emailing Functionality with C#, .NET 2.0, and Microsoft® SQL Server 2005 Service Broker'
Write your own Code Generator or Template Engine in .NET
Smart Code Generator .NET: Usage Overview
Smart Code Generator .NET: Architectural Overview
Smart Code Generator .NET: using with NAnt and Cassini

Archives

Free Programming Language Training

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

Print | posted on Tuesday, April 24, 2007 6:08 PM |

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 4 and 6 and type the answer here:

Powered by: