ZZ BC#7.5 asp.net mvc practice and guideline refresh!

2,029 views

Published on

15/01/2012
ZZ BC#7.5 : Slide Presentation
Code Sample : ZZBC#7.5_ASPNETMVC
http://tinyurl.com/834chox

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,029
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
30
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ZZ BC#7.5 asp.net mvc practice and guideline refresh!

  1. 1. Zubzib Black Coffee #7.5 !  
  2. 2.  Chalermpon Areepong (Nine) Microsoft MVP ASP.NET Work @
  3. 3. Audience Skill HTML/JS/CSS JavaScript C# OOP LINQ
  4. 4.  Basic ASP.NET MVC Programming NuGet Package Manager Entity Framework 4.x Code First Introduce EF Migration Deep in Model Deep in Controller Deep in View UI JavaScript Framework Application Layer Architecture Repository Pattern Dependency Injection Security ASP.NET MVC 4 Preview
  5. 5.  Model : o Class Model o Entity Model o Domain Transfer Object (DTO) o View Model View : User Interface o Engine : ASPX ViewEngine, Razor ViewEngine, Etc…… o Output: HTML, CSS, JavaScript, JSON, Text Controller o Control logic, o Data access, o Prepare parameters for view render o call view to render output
  6. 6.  DEMO
  7. 7.  Routes o Catch URL to parameter by pattern • Default “{controller}/{action}/{id}” http://www.zz.com/blog/get/1 • Fix route value new { controller = “blog”, action = “get”, id = 1 } • Custom Routes • blog/Archive/12-25-2009 “{controller}/{action}/{date}” http://www.zz.com/blog/Archive/12-25-2009 Public ActionResult Archive(DateTime date) • blog/Archive/12-25-2009_12-17-2011 “{controller}/{action}/{dateFrom}_{dateTo}” http://www.zz.com/blog/Archive/12-25-2009_12-17-2011 public ActionResult Archive(DateTime dateFrom, DateTime DateTo)
  8. 8.  Routes DEMO
  9. 9.  Manage Library for o Search o Install / Update / Uninstall o Execute library command (PowerShell) VS - > Menu -> Tools -> Extension Manager -> Find NuGet and install How to use o Solution->Project -> right click on +Reference -> nuget package o Package Manager Console • Install-Package <package name> • Uninstall-Package <package name> • Get-Package • Update-Package //all available
  10. 10.  DEMO
  11. 11.  Object Relational Mapping POCO Convention Over Configuration LINQ Support Working with various database (3rd party driver) Fluent API to fully customize the persistence mapping Database Installation Database Migration
  12. 12.  DEMO
  13. 13.  Model? o Rich Domain? o Model Entity? o DTO? Validation? o Server Side • DataAnotation Attribute • IValidationObject • FluentValidate o Client Side • ClientValidation • IClientValidatable Demo
  14. 14.  Controller ActionResult Demo
  15. 15.  ViewEngine o Razor ViewEngine (WebPage) o Aspx ViewEngine o 3rd Party ViewEngine JavaScript Demo
  16. 16. All will render to HTML/ CSS / JavaScript JQuery UI Telerik MVC Extension (strong type helper) Knockout (MVVM) Kendo UI (HTML5)
  17. 17.  DEMO
  18. 18.  Encapsulate data access Simple collection like interface Should only return aggregate roots Provide for adding and removing entities Provide methods to select objects based on some criteria Allow easy substitution
  19. 19.  DEMO
  20. 20. Motivation – Logical layers separate the major concerns ofthe application: 1. Modularity, low-coupling – easier maintenance. 2. Business-logic is separated from presentation – reuse. 3. General technical services, e.g., database, are separated from the business-logic – reused, replaced. 4. Low coupling, separation of concerns – evolving functionality, system scaling-up, adapt to new technologies.
  21. 21.  DEMO
  22. 22.  Dependency Injection - one example of IoC design principle. Also known as the Hollywood Principle o Don’t call us, we’ll call you! Good OO Systems – organised as web of interacting objects Goal – High cohesion, low coupling Advantages of low coupling o Extensibility o Testability o ReusabilityPS>Not so easy to achieve!
  23. 23.  AutoFac AutoFac MVC Integration Demo
  24. 24.  Windows Authentication Form Authentication Asp.net Membership Provider Controller and Action o Authorize Attribute o FluentSecurity (robust, fluent syntax)
  25. 25.  New Default project templates New mobile project template Recipes to customize code generation Asynchronous methods
  26. 26.  Bye…

×