posts - 236, comments - 436, trackbacks - 56

My Links

News

Awarded Microsoft MVP C#.NET - 2007, 2008 and 2009


I am born in Bangladesh and currently live in Melbourne, Australia. I am a Microsoft Certified Application Developer MCAD Chartered Member (C# .Net)and born in Bangladesh.
I am founder and Chief Executive Officer of
Simplexhub, a highly experienced software development company based in Melbourne Australia and Dhaka, Bangladesh. Co-founder and core developer of Pageflakes www.pageflakes.com.
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.


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

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

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

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: