View
3.992
Download
5
Category
Tags:
Preview:
DESCRIPTION
MVC Architecture in ASP.Net By Nyros Developer
Citation preview
AgendaAgenda
What is ASP.NET MVCWhat is MVCMVC FlowRoutingUsing Ajax & SecurityChoosing Between MVC and Web formsWhich one is better ?Summary
What is ASP.NET MVC?What is ASP.NET MVC?
A new Web Application Project type
Simply an option• Not a replacement for WebForms• Builds on top ASP.NET• Manual vs Automatic Transmission
What is MVC?What is MVC?
ModelModel
ControllerControllerViewView
Separation Of ConcernsSeparation Of Concerns
Each component has one
responsibility
– SRP : Single Responsibility Principle
–More easily testable
Helps with concurrent development
• Not the new Web Forms 4.0
• Not replacing Web Forms, but Adds to it
• It can not use Web Controls
• Not a whole new engine but sits on ASP.NET engine
• Not the best solution for REST
What MVCWhat MVC is not ?is not ?
Maintain Clean Separation of Concerns
• Extensible and PluggableEnable clean URLs and HTMLGreat integration within
ASP.NET
• Tooling Support
MVC Flow MVC Flow
URLs -> application -> Controller Action
Construct outgoing URLs
– Constructed URLs can be used to call back to Controllers/Actions
Routing EngineRouting Engine
Sequence Diagram ASP.Net MVC Flow
Ajax is not just “Update Panel” You can use
– Page methods– Web Services
They all require you to write a lot of javascript
MVC Ajax helps with Forms and ActionLinks !!
Ajax SupportAjax Support
Built in Controller for LoggingUsing ASP.NET Security ProvidersHaving the ability to control the security
level of each controller method
Security SupportSecurity Support
Choosing Between WebForms and MVCChoosing Between WebForms and MVC
Now that Asp.Net is much more mainstream at work,
The question is asked time and again as to which one should be used while developing a Web Application.
One possible way to answer this question is to do a analysis of both the frameworks.
ASP.Net MVC VS Web Forms
Uses the ‘Front Controller’ pattern. There is a single central controller for all pages to process web application requests and facilitates a rich routing architecture
At its core, ASP.NET MVC was designed to make test-driven development easier. You ‘can’ test your Controller without instantiating a View and carry out unit-tests without having to run the controllers in an ASP.NET process.
Uses the ‘Page Controller’ pattern. Each page has a code-behind class that acts as a controller and is responsible for rendering the layout.
At its core, you ‘cannot’ test your controller without instantiating a View. There are ways to get around it using tools
ASP.Net MVC VS Web Forms
A thorough understanding of how HTML, CSS and JavaScript work together is required. The advantage is you can do a lot of jQuery and AJAX stuff in an efficient and simple manner than you would do in an ASP.NET application.
You lose the 'drag and drop' quick model of building your web applications.
Deep understanding of HTML, CSS and JavaScript is not required to a large extent since the WebForm model abstracts a lot of these details and provides automatic plumbing. While abstracting details to provide ease of use, sometimes a solution is overcomplicated, than it needs to be.
Can drastically reduce time while building up intranet and internet applications that use a lot of controls (drag and drop model).
WebForms ???????
MVC ??????
Which one is better ?
Not a replacement for WebForms
– All about alternatives
Fundamental
– Same team that builds WebForms
Summary
Recommended