3-TIER ARCHITECTURE IN ASP.NET MVC
-
Upload
mohd-manzoor-ahmed-mct -
Category
Technology
-
view
996 -
download
10
description
Transcript of 3-TIER ARCHITECTURE IN ASP.NET MVC
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Live Project - Web Appon Asp.Net MVC
- Mohd Manzoor Ahmed (MCTS, MCPD & MCT)
www.manzoorthetrainer.com
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Project Plan
● Understanding Requirements and Database Design.● Creating Solution and Adding projects to It.● Creating The business Objects.● Creating Data Access Layer in EF.● Creating Business Logic Layer in C#.Net.● Creating Presentation Logic Layer in MVC5.● Designing Models, Controllers and Views.● Business Rules Validations.● Securing Your App.● Implementing Transactions.● Ajaxifying Your App.● Conclusion And Feedback
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Finalized Requirements
Link hub is a web portal where a user can submit their portal URL under a specific category to be shared on link hub. Admin can approve or reject the URL submitted by the user and in each case an email is sent out to the user. Once the link is approve it will be available on the link hub portal under a specific category.
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Defining the Roles & Responsibilities
Roles:
• Usero Can Browse URLso Can Registero Can Submit A URL
• Admino Can CRUD Category o Can View All Userso Can ApproveOrReject URL
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Identifying the Objects
• User
• Category
• Url
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• Category : Url 1--------------------> n
n--------------------> 1 (X)
n--------------------> n (X)
o (1:M)
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• User : Url 1--------------------> n
n--------------------> 1 (X)
n--------------------> n (X)
o (1:M)
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The Relationships
• Objectso Usero Categoryo Url
• Relationships
o Category : Url (1:M)
o User : Url (1:M)
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
3 Key Rules For Database Design
1. One table for each object
2. For 1:M relationship. 1 will become master and M will become child i.e., primary key of 1 will act as a foreign key for M.
Eg:Department : Employees is 1 : M
Department Table
Did
DName
Description
Employee Table
Eid
EName
ESalary
Did
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
3 Key Rules For Database Design
3. M:M relationship. Both the objects will become master and there will be one more new table called as transaction table or child table with primary keys of masters as foreign Keys in it.
Eg:Student : Course is M : M
Student Table
Sid
SName
SAddress
Course Table
Cid
CName
Description
Student_Course Table
SCId
Sid
Cid
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Designing Database
tbl_Category
CategoryId
tbl_Url
UrlId
UId
CategoryId
tbl_User
UId
Role
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Implementing DatabaseLets go and Implement
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Inserting Dummy RecordsLets go and Insert dummy and meaningful records
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Design Project Arch.
DALAdo.Net
EF
Result c
BLLC#.Net
c=a+b
UIAsp.Net
MVC
a=10;b=20;
show c
DatabaseMS SQL
Business Objects (BO)
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Design Project Arch.
● UI● BLL● DAL● BOL
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Solution and Adding projects to ItLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business ObjectsBasically a business object layer contains classes equivalent to the tables i.e.,
one class for each table.Eg:If I have a department table
tbl_Department (Relation)
Did
DName
Description
\\Objectclass tbl_Department {Public int Did {get;set;}Public string DName {get;set;}Public string Description {get;set;}}
i.e., O/R M
Lets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business Objects - Relationship(1:M)
\\Objectclass tbl_Deptartment{public int Did {get;set;}public string DName {get;set;}public string Description {get;set;}public virtual List<tbl_Employee> tbl_Employees {get;set;}}
tbl_Department
Did
DName
Description
tbl_Employee
Eid
EName
ESalary
Did
\\Objectclass tbl_Employee{public int Eid{get;set;}public string EName {get;set;}public double Esalary {get;set;}public int Did{get;set;}public virtual tbl_Department {get;set;}}
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business Objects - Relationship(M:M)
tbl_Student
Sid
SName
SAddress
tbl_Course
Cid
CName
Description
tbl_Student_Course
SCId
Sid
Cid
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating The business Objects - Relationship(M:M)
\\Objectclass tbl_Student{public int Sid{get;set;}public string SName {get;set;}public string Address {get;set;}public virtual List<tbl_Student_Course> tbl_Student_Courses {get;set;}}
\\Objectclass tbl_Course{public int Cid{get;set;}public string CName {get;set;}public string CDescription {get;set;}public virtual List<tbl_Student_Course> tbl_Student_Courses {get;set;}}
\\Objectclass tbl_Student_Course{public int SCid{get;set;}public int Sid {get;set;}public int Cid {get;set;}public virtual tbl_Student {get;set;}public virtual tbl_Course {get;set;}}
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Of UI/PL
DALAdo.N
etEF
Result c
BLLC#.Net
c=a+b
UIAsp.Net
a=10;b=20;
show c
DatabaseMS SQL
Business Objects (BO)
DatabaseMS SQL
Business Objects (BO)
UIAsp.Net
MVC
a=10;b=20;
show c
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Roles & Responsibilities
Roles:
• Usero Can Browse URLso Can Registero Can Submit A URL
• Admino Can CRUD Category o Can View All Userso Can ApproveOrReject URL
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Home
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Category
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
ListCategories
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Register
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
SubmitURL
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
ApproveURLs
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
BrowseURLs
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
ListUsers
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Login
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
UI - Modules
• Usero SubmitURL
• Admino Categoryo ListCatergorieso ListUserso ApproveURLs
• Commono Homeo BrowseURLs
• Securityo Logino Register
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
SubmitURL
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
User Controllers Design
Controller Action
URL Index [Display Form - HttpGet]
Create [Submit Form - HttpPost]
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Admin Controllers Design Controller Action
Category Index[Display Form - HttpGet]
Create [Submit Form - HttpPost]
ListCategory Index [Display List - HttpGet]
ListUser Index [Display List - HttpGet]
ApproveURLs Index [Display List - HttpGet]
Approve [Submit Form- HttpPost]
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Category
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
CategoriesList
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
List Users
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Approve URLs
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Common Controllers Design
Controller Action
Home Index [Display Calender - HttpGet]
BrowseURLs Index [Display List Form - HttpGet]
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Home
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Browse Urls
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Security Controllers Design
Controller Action
Login Index[Display Form- HttpGet]
SignIn[Submit Form - HttpPost]
Register Index[Display Form - HttpGet]
Create[Submit Form- HttpPost]
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Login
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Registration
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Data Access LayerLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Business Logic LayerLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Creating Of UI/PL
DALAdo.Net
Result c
BLLC#.Net
c=a+b
UIAsp.Net
a=10;b=20;
show c
DatabaseMS SQL
Business Objects (BO)
DatabaseMS SQL
Business Objects (BO)
UIAsp.Net
a=10;b=20;
show c
BLLC#.Net
c=a+b
DALAdo.Net
Result c
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Form ValidationsLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Business Rule ValidationsLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
AuthenticationLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
AuthorizationLets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Applying Bootstrap Theme
Lets go and implement it
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Advanced Operations
• Binding multiple models to a single View• Implementing transactions• Ajaxifying MVC App• External Logins [Like Facebook Login]
www.ManzoorTheTrainer.com | Enroll here [MVC 3-Tier (50% Off)] :http://goo.gl/iMulis
Thanks