mvc architecture in asp.net by nyros developer

24

Upload: nyros-technologies

Post on 14-May-2015

3.989 views

Category:

Documents


5 download

DESCRIPTION

MVC Architecture in ASP.Net By Nyros Developer

TRANSCRIPT

Page 1: MVC Architecture in ASP.Net By Nyros Developer
Page 2: MVC Architecture in ASP.Net By Nyros Developer

AgendaAgenda

What is ASP.NET MVCWhat is MVCMVC FlowRoutingUsing Ajax & SecurityChoosing Between MVC and Web formsWhich one is better ?Summary

Page 3: MVC Architecture in ASP.Net By Nyros Developer

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

Page 4: MVC Architecture in ASP.Net By Nyros Developer

What is MVC?What is MVC?

ModelModel

ControllerControllerViewView

Page 5: MVC Architecture in ASP.Net By Nyros Developer

Separation Of ConcernsSeparation Of Concerns

Each component has one

responsibility

– SRP : Single Responsibility Principle

–More easily testable

Helps with concurrent development

Page 6: MVC Architecture in ASP.Net By Nyros Developer

• 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 ?

Page 7: MVC Architecture in ASP.Net By Nyros Developer

Maintain Clean Separation of Concerns

• Extensible and PluggableEnable clean URLs and HTMLGreat integration within

ASP.NET

• Tooling Support

Page 8: MVC Architecture in ASP.Net By Nyros Developer

MVC Flow MVC Flow

Page 9: MVC Architecture in ASP.Net By Nyros Developer
Page 10: MVC Architecture in ASP.Net By Nyros Developer
Page 11: MVC Architecture in ASP.Net By Nyros Developer

URLs -> application -> Controller Action

Construct outgoing URLs

– Constructed URLs can be used to call back to Controllers/Actions

Routing EngineRouting Engine

Page 12: MVC Architecture in ASP.Net By Nyros Developer

Sequence Diagram ASP.Net MVC Flow

Page 13: MVC Architecture in ASP.Net By Nyros Developer

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

Page 14: MVC Architecture in ASP.Net By Nyros Developer

Built in Controller for LoggingUsing ASP.NET Security ProvidersHaving the ability to control the security

level of each controller method

Security SupportSecurity Support

Page 15: MVC Architecture in ASP.Net By Nyros Developer

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.

Page 16: MVC Architecture in ASP.Net By Nyros Developer
Page 17: MVC Architecture in ASP.Net By Nyros Developer
Page 18: MVC Architecture in ASP.Net By Nyros Developer

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

Page 19: MVC Architecture in ASP.Net By Nyros Developer

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).

Page 20: MVC Architecture in ASP.Net By Nyros Developer

WebForms ???????

MVC ??????

Which one is better ?

Page 21: MVC Architecture in ASP.Net By Nyros Developer
Page 22: MVC Architecture in ASP.Net By Nyros Developer

Not a replacement for WebForms

– All about alternatives

Fundamental

– Same team that builds WebForms

Summary

Page 23: MVC Architecture in ASP.Net By Nyros Developer
Page 24: MVC Architecture in ASP.Net By Nyros Developer