1 / 0

INTRO TO THE NETTIERS FRAMEWORK

An Automated Object Relational Mapper. INTRO TO THE NETTIERS FRAMEWORK. What is NetTiers. Discovered Indirectly While Using Mojo NetTiers = Open Source = FREE Backed by CodeSmith Template Driven Source Code Generator

sachi
Download Presentation

INTRO TO THE NETTIERS FRAMEWORK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Automated Object Relational Mapper

    INTRO TO THE NETTIERS FRAMEWORK

  2. What is NetTiers Discovered Indirectly While Using Mojo NetTiers = Open Source = FREE Backed by CodeSmith Template Driven Source Code Generator CodeSmith = Commercial ($99 - older versions are free, have $10 off coupon http://www.codesmithtools.com/ Basically is a Complex CodeSmith Template That Auto Generates N-Tier Web Applications w/ relevant CRUD, validation, unit-testing, deeploading (more later), etc.
  3. CodeSmith Template Generators NetTiers NHibernate PLINQO Wilson’s ORMapper APOSA See more at http://www.codesmithtools.com/features/frameworks.aspx
  4. NetTiers Features Generates a pre-compiled solution along with separate projects and framework tiers for your application Creates Entities/Classes Based On Your Defined DB Schema - http://nettiers.com/database.ashx Partial/Concrete Classes nUnit testing Very robust data API Much more
  5. Example Sites DSA Site Inventory - https://wsnet.colostate.edu/CWIS463/dsa-sites/ Diversity Library System - http://wsnetdev.colostate.edu/CWIS165/home RDS Exam Intake System - http://wsnet.colostate.edu/cwis248/exams/
  6. Observations Has a bit of a learning curve (eg. Took me a few days to understand how to make url routing work in the framework) MOST IMPORTANT – Spend all the time you need to get your DB schema right before generating Know what you’re doing when regenerating solution after a db schema change I plan on using it for most any medium to large project (at least when doing web forms). Is overkill for small projects. Guessing it made a (minimum) 20 hour job take 2 hours for the DSA site inventory Lot more to learn – only used a month or two
  7. Let’s Build a Site Db Schema – Nail This Down Download/Install CodeSmith & NetTiers Open the NetTiers template file (.cst) Mandatory Fields: SourceDB (YOUR SQL DB INSTANCE) MappingFile OutputDirectory (LOCATION OF PROJECT) RootNameSpace (YOUR_SITE) http://nettiers.com/GettingStarted.ashx#CB:_AB_Getting_Started_-_Required_Properties_0
  8. Let’s Build a Site Recommended Fields: SourceTables IncludeComponentLayer - ServiceLayer and DomainModel (your business layer) IncludedDatabaseFeatures – SQLServer2005 IncludeUnitTest - True DataSourceEnableTransactionDefault – False IncludeAtlasLibrary – (learned about today) IncludeAtlasToolkit
  9. Let’s Build a Site Post Generation: Open VS and convert solution to rely on .net 4.0 if desired Move UI files (App_Themes, Common, MasterPage, SiteMap) over Set Default Page to Admin/Default.aspx Run solution Demo Declarative Stuff Demo Code Behind Stuff
  10. To Demo Declarative Stuff Add Exam Request (note ddls generated from foreign keys) Search Export Edit UserControls - DRY Code-Behind Using the ServiceLayer API http://nettiers.com/ComponentLayer.ashx
  11. Validation – ExamRequestsBase.generated /// <summary> /// Assigns validation rules to this object based on model definition. This file is overwritten upon regeneration! /// </summary> /// <remarks>This method overrides the base class to add schema related validation.</remarks> protected override void AddValidationRules() { //Validation rules based on database schema. ValidationRules.AddRule( CommonRules.NotNull, new ValidationRuleArgs("CourseNumber", "Course Number")); ValidationRules.AddRule( CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("CourseNumber", "Course Number", 256)); ValidationRules.AddRule( CommonRules.NotNull, new ValidationRuleArgs("SectionNumber", "Section Number")); ValidationRules.AddRule( CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("SectionNumber", "Section Number", 256)); ValidationRules.AddRule( CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("ExamDelivery", "Exam Delivery", 256)); ValidationRules.AddRule( CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("ExamReturn", "Exam Return", 256)); ValidationRules.AddRule( CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("TimeAllowed", "Time Allowed", 100)); }
  12. Validation – EntityRequests.cs Partial Class File Not Overwritten. More Info On Validation - http://nettiers.com/EntityLayer.ashx /**/ /// <summary> /// Validates the exam date. /// </summary> /// <param name="target">The target.</param> /// <param name="e">The e.</param> /// <returns></returns> private boolValidateExamDate(object target, Validation.ValidationRuleArgs e) { if ((this.ExamDate ?? DateTime.MinValue) < DateTime.Today) { e.Description = "The exam date must not be in the past."; return false; } return true; }
  13. Going Forward Add more unit tests Add Elmah library to effectively handle application errors http://code.google.com/p/elmah/ Add Sandcastle Documentation Compiler to tie comments together http://sandcastle.codeplex.com/ CSS-based pretty forms – pForm Blueprint CSS stylesheet resets OWASP, if necessary?
  14. Useful Links NetTiers on GoogleCode - http://code.google.com/p/nettiers/ NetTiers Documentation - http://nettiers.com/DocumentationPage.ashx Tlist Tips/Tricks - http://community.codesmithtools.com/CodeSmith_Community/b/nettiers/archive/2006/03/09/10861.aspx
More Related