posts - 234, comments - 480, trackbacks - 56

My Links

News




I am born in Bangladesh and currently live in Melbourne, Australia. I am a co-founder and core developer of Pageflakes www.pageflakes.com and CEO at Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Simplexhub, is on its mission to build a smart virtual community in Bangladesh and recently launched beta realestatebazaar.com.bd an ASP.NET MVC application written in C#.NET.

I also created SmartCodeGenerator

Some of 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 A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: