Generating DAL using CodeSmith and .Nettiers (step by step)
Here is a post for generating DAL (Data Access layer) using CodeSmith and .Nettiers for any C# project. This post is a part of document guide I have written for a client of my company.
For whom don't know what is Codesmith :
CodeSmith is a software development tool to help you get your job done faster. Technically speaking it is a template driven source code generator that automates the creation of common application source code for any language (C#, Java, VB, PHP, ASP.NET, SQL, etc.).(http://www.codesmithtools.com/)
And .Nettiers :
.netTiers utilizes the power of the best code generation tool available today, CodeSmith. .netTiers generated architecture is custom to your domain, uses familiar patterns, and follows the guidance of Microsoft's recommended patterns and practices. In fact, the .netTiers base architecture is built upon the Microsoft Enterprise Library Application Blocks.(http://nettiers.com/)
Note : these steps captured with CodeSmith 3.2 and .NetTiers but almost versions are the same.
Opening CodeSmith 3.2:
1. After setup the CodeSmith 3.2, open it from the start menu.
2. If you haven’t license, you can continue with the trial version by pressing “Try” button.
3. From the File menu of CodeSmith press “Open” and select the Nettiers.cst inside NetTiers 2.2.0 folder.
4. Open the configuration XML file and change the connection string as in the picture(if you haven't Configuration file or this is first time to work with that drop this step).5. From the Properties Tab click the open icon then select the configuration XML file(if you haven't Configuration file or this is first time to work with that drop this step).
6. Configure the Properties Tab then Press the run icon.
7. Be sure that no errors in the generated report and open the solution file (generated in the output directory).
8. Build the whole solution.
• your RootNameSpace.Data.dll
• your RootNameSpace.Data.SqlClient.dll
• your RootNameSpace.Entities.dll
Happy Coding :)
No comments:
Post a Comment