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

Example1: SmartCodeGenerator Familiarization

Example1 Makes you familiar with SmartCodeGenerator.
Generating code from existing project/template.

Step1 Opening Existing Template

Open Example1 from Example_Projects folder, as a website project in Visual Studio 2005.

Step2 Launching the Generator

Run the project you have opened from Visual Studio 2005 and this will display the default.aspx page.

Notice the property1 and the textbox to enter value. The properties lets you customize the generated code. Here we are collecting value for property1 and this can be used in the generated template.

Step3 Generating the Text or Code

Simply click the Generate Button. And this will generate code for you. If there was any compilation error VS2005 would have picked that up very easily as it normally does for your asp.net application.

Step5. Reviewing the Template

Expand the Template Folder and open Exampl11Template.ascx file and go to source view. This would look like the following.

And the Code behind is where I have declared a property CurrentDateTime.

And the Generated Code should look like this. The DateTime.Now.ToString() is simply replaced by the current datetime.

And remember you have full support of the Greatest Visual Studio 2005 Environment [Debugging, Compilation, CodeSnippet and countless etc.]

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

Print | posted on Saturday, November 25, 2006 10:03 AM |

Feedback

No comments posted yet.
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 

Powered by: