During 4 days, I presented a training session for the .Net team in Business & Decision Tunisia about Asp.net MVC.
In this training we talked about:
MVC as a design pattern the history and the utility
Microsoft’s approach in Asp.net MVC
What's new in MVC 4
Data Access in Asp.net MVC
How to secure an Asp.net application
Dependency Injection in Asp.net MVC
Scale your database traffic with Read & Write split using MySQL Router
Asp.net MVC training session
1.
2. • A design Pattern (Methodology)
• Invented by Smalltalk programmer (Trygve
Reenskaug 1979).
• Separation of Concerns / Single Responsibility
Principle
• More easily testable
3. M
Model
V
View
C
Controller
• Representation of domain data
• Business Logic
• Persistence mechanisms
• User Interface
• The representation of Model
• An intermediary between Model and View
• Application’s Brain (Handle user requests, bind
Data, return views)
5. • Part of ASP.NET
• Not an upgrade or replacement for Web Forms
ASP.NET
Webforms MVC Webpages
6. • No server controls
• No ViewState
• No Code Behind
• Full control over html
• Unit Testing
7. • Separation of application tasks (No code Behind)
• Flexibility and Extensibility
• Friendly URLs (Routing)
• Scalability and Performance
• Supports existing ASP.NET features
(Authentication, Membership, roles, output
caching,…)
• Natural integration with Ajax
8.
9. • View Engines
o Aspx
o Razor
• Layout
• Partial View
• Section
• HtmlHelper, AjaxHelper
10. • ActionLink
@Html.ActionLink(“Modifier", “Edit“, new {Id=3})
<a href="/Product/Edit/6">Modifier</a>
• Form Elements (Form, TextBox, Hidden,….)
@Html.TextBox(“Nom")
<input id=" Nom " type="text" value="" name=" Nom ">
11. • DropDownList
var db = new NorthwindDataContext();
IEnumerable<SelectListItem> items = db.Categories
.Select(c => new SelectListItem { Value = c.CategoryID.ToString(), Text = c.CategoryName });
ViewBag.Categories = items;
@Html.DropDownList("CategoryID",
(IEnumerable<SelectListItem>) ViewBag.Categories)
22. • Open source package manager for the .NET
Framework
• Provide the ability to produce and consume packages
23.
24. • Bundling & Minification
• Web Api
• Template Mobile
• Asynchronous
• RealTime avec SignalR
25. Improve JavaScript and CSS files loading
• Minimize the Number of requests (Bundle in
one File)
• Reduce the size of files (remove spaces, enters
and comments)
Fully customizable and extensible
30. • Object-relational mapping (ORM) Framework
• Gives an automated mechanism for Data Access
• Manipulate Data as Object
• Reduce hard coded Query
• Have inheritance relationships between entities
• Performing basic CRUD(Create, Read, Update, Delete)
31.
32. • Existing DataBase
• Generate .Edmx From DataBase
• Use ObjectContext & DBContext
• Use T4 template (POCO)
33. • Empty Edmx Model
• Design th DB Schema
• Generate DataBase From Model
34. • Create Domain Models (Class)
• Generate DataBase From Domain Models
• Full Control Over Code
• No Autogenerated code