Your SlideShare is downloading. ×
ASP.NET MVCPractice and GuidelineZubzib Black Coffee #7
About me                      • Chalermpon Areepong (Nine) • Microsoft MVP ASP.NET • Work @
Session Level 300Audience Skill• HTML• JavaScript• C#• OOP• LINQ
Agenda• Basic ASP.NET MVC Programming    o   Model    o   View    o   Controller    o   Routes•   NuGet Package Manager•  ...
Basic of ASP.NET MVCPrograming• Model :   o Class Model, Domain Transfer Object (DTO), View Model   o Model Validation    ...
Basic of ASP.NET MVCPrograming• DEMO
Basic of ASP.NET MVC Programing• Routes  o Catch URL to parameter by pattern     • Default               “{controller}/{ac...
Basic of ASP.NET MVC Programing• Routes DEMO
NuGet Package Manager• Library Utility for   o Search   o Install / Update / Uninstall   o Execute library command (PowerS...
NuGet Package Manager• DEMO
EF 4.x Code First•   Object Relational Mapping•   POCO•   Convention Over Configuration•   LINQ Support•   Working with va...
EF 4.x Code First• DEMO
MVC UI LibraryAll will render to HTML/ CSS / JavaScript• JQuery UI• Telerik MVC Extension (current not full support   HTML...
MVC UI Library• DEMO
Software Design:Repository Pattern• Encapsulate data access• Simple collection like interface• Should only return aggregat...
Software Design:Repository Pattern• DEMO
Software Design:Core Layer ArchitectureMotivation – Logical layers separate the majorconcerns of the application:• 1. Modu...
Software Design:Core Layer Architecture
Software Design:Core Layer Architecture• DEMO
Dependency Injection• Dependency Injection - one example of IoC design  principle.• Also known as the Hollywood Principle ...
Dependency Injection• Demo
Summary•   ASP.NET MVC•   NuGet•   EF Code First•   JavaScript Framework•   AutoFac MVC Integration• Bye…
Upcoming SlideShare
Loading in...5
×

ZZ BC#7 asp.net mvc practice and guideline by NineMvp

1,379

Published on

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

No Downloads
Views
Total Views
1,379
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "ZZ BC#7 asp.net mvc practice and guideline by NineMvp"

  1. 1. ASP.NET MVCPractice and GuidelineZubzib Black Coffee #7
  2. 2. About me • Chalermpon Areepong (Nine) • Microsoft MVP ASP.NET • Work @
  3. 3. Session Level 300Audience Skill• HTML• JavaScript• C#• OOP• LINQ
  4. 4. Agenda• Basic ASP.NET MVC Programming o Model o View o Controller o Routes• NuGet Package Manager• Entity Framework 4.x Code First Introduce• Application Layer Architecture• Repository Pattern• Dependency Injection
  5. 5. Basic of ASP.NET MVCPrograming• Model : o Class Model, Domain Transfer Object (DTO), View Model o Model Validation • Validation Attribute, IValidationObject Interface• View : User Interface o Engine : ASPX ViewEngine, Razor ViewEngine, Etc…… o HTML, CSS, JavaScript• Controller o Control logic, o Data access, o Prepare parameters for view render o call view to render output
  6. 6. Basic of ASP.NET MVCPrograming• DEMO
  7. 7. Basic of ASP.NET MVC Programing• 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 o blog/Archive/12-25-2009 “{controller}/{action}/{date}” http://www.zz.com/blog/Archive/12-25-2009 Public ActionResult Archive(DateTime date) o 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. Basic of ASP.NET MVC Programing• Routes DEMO
  9. 9. NuGet Package Manager• Library Utility 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 Project Reference o Package Manager Console • Install-Package <package name> • Uninstall-Package <package name> • Get-Package
  10. 10. NuGet Package Manager• DEMO
  11. 11. EF 4.x Code First• Object Relational Mapping• POCO• Convention Over Configuration• LINQ Support• Working with various database (3rd party driver)• Fluent API to fully customize the persistence mapping• Demo…..
  12. 12. EF 4.x Code First• DEMO
  13. 13. MVC UI LibraryAll will render to HTML/ CSS / JavaScript• JQuery UI• Telerik MVC Extension (current not full support HTML5)• Knockout (MVVM)• Kendo UI (HTML5)• Wijmo (HTML5)
  14. 14. MVC UI Library• DEMO
  15. 15. Software Design:Repository Pattern• 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
  16. 16. Software Design:Repository Pattern• DEMO
  17. 17. Software Design:Core Layer ArchitectureMotivation – Logical layers separate the majorconcerns of the 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.
  18. 18. Software Design:Core Layer Architecture
  19. 19. Software Design:Core Layer Architecture• DEMO
  20. 20. Dependency Injection• 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!
  21. 21. Dependency Injection• Demo
  22. 22. Summary• ASP.NET MVC• NuGet• EF Code First• JavaScript Framework• AutoFac MVC Integration• Bye…

×