Transcript Slide 1

CodeSmith & .netTiers
Using Code Generation to boost
productivity
Robert Hinojosa
[email protected]
Agenda
•
•
•
•
What is Code Generation?
What is CodeSmith?
What is .netTiers?
How can .netTiers help me?
What is Code Generation
• Software creation
• Can be fun and challenging
• …but also repetitive and monotonous
• Repetition & monotony leads to bugs
• Code generation is not a new concept
• With most tools you don’t control the output
• Often viewed as a “Black Box” solution
• Ex, data layer created (but it is not your code)
• CodeSmith 4.0
• Not a “Black Box” solution
• Template driven code generation (it is your code)
• Use existing templates or write new ones
The value of .netTiers
• The cost of creating a home grown
framework
• Design, Development, Test, Release
• Easily runs between $50 - $300/hour
• CodeSmith
• .netTiers 2.0: Free open source templates with
thriving community
• CodeSmith 4.0 Professional: $399
• For you, FREE!
• Equivalent to 3-6 hours of development
• Real value you can measure
• Dramatically reduces time to market & cost
• Quickly pays for itself
Using CodeSmith 4.0
What is .netTiers
.netTiers is a library of Codesmith templates that builds
object-relational mapping for an existing database.
• Creates objects and domain based on the
relationships in your database.
• Creates separate Logical layers Entity,
DAL, Business, Web, Forms, WebService
• Creates stored procedures or
parameterized SQL for data access layer.
• Creates Asp.Net 2.0 admin user controls.
• Creates code which is fully XML
commented
.netTiers Advantages
• 100% Open Source, Template Driven
• Reduces development time
• Reduces maintenance time
• All applications have a consistent domain model,
with standard code
• Making changes / updates by another team
member easier
• Promotes reuse
• Data Access completely separated from user
interface
• Promotes Enterprise Standards utilizing
Microsoft P & P Enterprise Library
• Easier Application Integration
Domain Model vs DataSet
• Predictable behavior
• Compare the following methods
• public Customer GetByCustomerId(int id);
• public DataSet GetByCustomerId(int id);
• Promotes loose coupling of
presentation and domain logic
• Easier to document
• Intellisense in Visual Studio
• Less memory intensive
Using .netTiers
Data API
• Support for basic CRUD: Update,
Delete, Insert, Find, Paged,
Custom Sprocs, GetBy (PK, IX,
FK, M:M)
• Support for queries using:
• Primary Key
• Foreign keys
• Indexes
• Many-Many join relationships
Data API
• Transaction Support
• API Plumbing generated from
Your own Stored Procedures
EX. _TableName_MyMethodName
• Support for deep object graph
loading/saving
• Use stored procedures or xml
embedded parameterized SQL
Sample Method Calls
//All Providers kept within DataRepository class
EmployeeCollection employees =
DataRepository.EmployeeProvider.GetAll();
//When using primary key, single object is returned
Employee emp = DataRepository.EmployeeProvider.GetByEmployeeId(4);
Employee newEmployee = new Employee();
newEmployee.FirstName = “John”;
newEmployee.LastName = “Doe”;
…
//when inserting the primary key value is set for the object
bool success =
DataRepository.EmployeeProvider.Insert(newEmployee);
//inserting collection
EmployeeCollection ec = new EmployeeCollection();
Employee e1 = new Employee();
…
ec.Add(e1);
bool success = DataRepository.EmployeeProvider.Insert(ec);
Using .netTiers API
Conclusion/ Q&A
• .netTiers 2.0
• Proven Pattern Based Framework Generation
• CodeSmith 4.0
• Most powerful code generation tool available
• Reduces time spent writing trivial code
• Be more productive
• Template driven means it’s still your code
• Saves you time and money
Learn more
• www.codesmithtools.com
• Download free 30 day trial
Contact Us
• [email protected]
• +1 972 407 0688