MVC 6 Introduction

ASP.NET MVC -
6
http://Sharma-
NareshIT.blogspot.com
DESIGN PATTERNS /
ARCHITECTURAL PATTERNS
Becoming a Chess Master
„ First learn rules and physical requirements
– e.g., names of pieces, legal movements, chess board
geometry and orientation, etc. „
Then learn principles
– e.g., relative value of certain pieces, strategic value of
center squares, power of a threat, etc. „
However, to become a master of chess, one
must study the games of other masters
– These games contain patterns that must be
understood, memorized, and applied repeatedly „There
are hundreds of these patterns
Becoming a Software Designer
Master
First learn the rules –
e.g., the algorithms, data structures and
languages of software „
Then learn the principles –
e.g., structured programming, modular
programming, object oriented programming,
generic programming, etc. „
However, to truly master software
design, one must study the designs of
other masters –
These designs contain patterns must be
understood, memorized, and applied repeatedly „
Design Patterns
Design patterns are solutions to software
design problems you find again and again in
real-world application development. Patterns
are about reusable designs and interactions of
objects..
The 23 Gang of Four (GoF) patterns are
generally considered the foundation for all other
patterns. They are categorized in three groups:
 Creational,
 Structural, and
 Behavioral
Creational Patterns
Abstract
Factory
Creates an instance of several families of classes
Builder Separates object construction from its representation
Factory
Method
Creates an instance of several derived classes
Prototype A fully initialized instance to be copied or cloned
Singleton A class of which only a single instance can exist
Structural Patterns
Adapter Match interfaces of different classes
Bridge Separates an object’s interface from its implementation
Composite A tree structure of simple and composite objects
Decorator Add responsibilities to objects dynamically
Facade A single class that represents an entire subsystem
Flyweight A fine-grained instance used for efficient sharing
Proxy An object representing another object
Behavioral Patterns
Chain of
Resp.
A way of passing a request between a chain of objects
Command Encapsulate a command request as an object
Interpreter A way to include language elements in a program
Iterator Sequentially access the elements of a collection
Mediator Defines simplified communication between classes
Memento Capture and restore an object's internal state
Observer A way of notifying change to a number of classes
State Alter an object's behavior when its state changes
Strategy Encapsulates an algorithm inside a class
Template
Method
Defer the exact steps of an algorithm to a subclass
Visitor Defines a new operation to a class without change
The Model-View-Controller (MVC) architectural pattern separates an
application into three main components: the model, the view, and the
controller.
The ASP.NET MVC framework provides an alternative to the ASP.NET Web
Forms pattern for creating Web applications.
The MVC Pattern
13
 Model–view–controller (MVC) is a software
architecture pattern
 Originally formulated in the late 1970s by
Trygve Reenskaug as part of the Smalltalk
 Code reusability and separation of concerns
 Originally developed for
desktop, then adapted
for internet applications
Father of MVC
http://heim.ifi.uio.no/~trygver/2007/MVC_Originals.pdf
Model
16
 Set of classes that describes the data we are
working with as well as the business
 Rules for how the data can be
changed and manipulated
 May contain data validation rules
 Often encapsulate data stored in a database as
well as code used to manipulate the data
 Most likely a Data Access Layer of some kind
 Apart from giving the data objects, it doesn't have
significance in the framework
View
17
 Defines how the application’s user interface
(UI) will be displayed
 May support master views (layouts) and sub-
views (partial views or controls)
 Web: Template to dynamically generate HTML
 Controlled by View Engines
Controller
18
 The core MVC component
 Process the requests with the help of views and
models
 A set of classes that handles
 Communication from the user
 Overall application flow
 Application-specific logic
 Every controller has one or more "Actions"
MVC Steps
19
 Incoming request routed to Controller
For web: HTTP request
 Controller processes request and creates
presentation Model
Controller also selects appropriate result
(view)
 Model is passed to View
 View transforms Model into appropriate output
format (HTML)
 Response is rendered (HTTP Response)
20
The MVC Pattern for Web
21
MVC Pattern in ASP.NET MVC
ASP.NET MVC Request
22
Request Flow
Request View Controller Model
HTTP
Select
ViewHTML
Routing
Select Controller
Stage Details
Receive first request for
the application
In the Global.asax file, Route objects are added to
the RouteTable object.
Perform routing The UrlRoutingModule module uses the first
matching Route object in theRouteTable collection to
create the RouteData object, which it then uses to create
aRequestContext (IHttpContext) object.
Create MVC request
handler
The MvcRouteHandler object creates an instance of
the MvcHandler class and passes it
the RequestContext instance.
Create controller The MvcHandler object uses
the RequestContext instance to identify
theIControllerFactory object (typically an instance of
the DefaultControllerFactoryclass) to create the
controller instance with.
Execute controller The MvcHandler instance calls the controller
s Execute method.
Invoke action Most controllers inherit from the Controller base class.
For controllers that do so,
theControllerActionInvoker object that is associated
with the controller determines which action method of the
controller class to call, and then calls that method.
Execute result A typical action method might receive user input, prepare
the appropriate response data, and then execute the
result by returning a result type. The built-in result types
that can be executed include the
following: ViewResult (which renders a view and is the
most-often used result
type), RedirectToRouteResult, RedirectResult,Content
MVC 6 Introduction
MVC Frameworks
26
 CakePHP (PHP)
 CodeIgniter (PHP)
 Spring (Java)
 Perl: Catalyst, Dancer
 Python: Django, Flask, Grok
 Ruby: Ruby on Rails, Camping, Nitro, Sinatra
 JavaScript: AngularJS, JavaScriptMVC, Spine
 ASP.NET MVC (.NET Framework)
ASP.NET Web Forms
 Stable and mature, supported by heaps of
third party controls and tools
 Event driven web development
 Postbacks
 Viewstate
 Less control over the HTML
 Hard to test
 Rapid development
ASP.NET MVC
28
 Runs on top of ASP.NET
 Not a replacement for WebForms
 Leverage the benefits of ASP.NET
 Embrace the web
 User/SEO friendly URLs, HTML 5, SPA
 Adopt REST concepts
 Uses MVC pattern
 Conventions and Guidance
 Separation of concerns
ASP.NET MVC (2)
29
 Tight control over markup
 Testable
 Loosely coupled and extensible
 Convention over configuration
 Razor view engine
 One of the greatest view engines
 With intellisense, integrated in Visual Studio
 Reuse of current skills (C#, LINQ, HTML, etc.)
 Application-based (not scripts like PHP)
Separation of Concerns
30
 Each component has one responsibility
 SRP – Single Responsibility Principle
 DRY – Don’t Repeat Yourself
 More easily testable
 TDD – Test-driven development
 Helps with concurrent development
 Performing tasks concurrently
 One developer works on views
 Another works on controllers
Extensible
31
 Replace any component of the system
 Interface-based architecture
 Almost anything can be replaced or extended
 Model binders (request data to CLR objects)
 Action/result filters (e.g. OnActionExecuting)
 Custom action result types
 View engine (Razor, WebForms, NHaml, Spark)
 View helpers (HTML, AJAX, URL, etc.)
 Custom data providers (ADO.NET), etc.
Clean URLs
32
 REST-like
 /products/update
 /blog/posts/2013/01/28/mvc-is-cool
 Friendlier to humans
 /product.aspx?catId=123 or post.php?id=123
 Becomes /products/chocolate/
 Friendlier to web crawlers
 Search engine optimization (SEO)
ASP.NET Web Forms ASP.NET MVC
Asp.Net Web Form follow a traditional event
driven development model.
Asp.Net MVC is a lightweight and follow MVC
(Model, View, Controller) pattern based
development model.
Asp.Net Web Form has server controls. Asp.Net MVC has html helpers.
Asp.Net Web Form supports view state for
state management at client side.
Asp.Net MVC does not support view state.
Asp.Net Web Form has file-based URLs means
file name exist in the URLs must have its
physically existence.
Asp.Net MVC has route-based URLs means
URLs are divided into controllers and actions
and moreover it is based on controller not on
physical file.
Asp.Net Web Form follows Web Forms Syntax
Asp.Net MVC follow customizable syntax
(Razor as default)
In Asp.Net Web Form, Web Forms(ASPX) i.e.
views are tightly coupled to Code
behind(ASPX.CS) i.e. logic.
In Asp.Net MVC, Views and logic are kept
separately.
Asp.Net Web Form has Master Pages for
consistent look and feels.
Asp.Net MVC has Layouts for consistent look
and feels.
Asp.Net Web Form has User Controls for code
re-usability.
Asp.Net MVC has Partial Views for code re-
usability.
Asp.Net Web Form has built-in data controls
and best for rapid development with powerful
data access.
Asp.Net MVC is lightweight, provide full control
over markup and support many features that
allow fast & agile development. Hence it is best
for developing interactive web application with
latest web standards.
Asp.Net Web Form is not Open Source. Asp.Net Web MVC is an Open Source.
The ASP.NET MVC History
34
Date Version
10 December 2007 ASP.NET MVC
13 March 2009 ASP.NET MVC 1.0
16 December 2009 ASP.NET MVC 2 RC
4 February 2010 ASP.NET MVC 2 RC 2
10 March 2010 ASP.NET MVC 2
6 October 2010 ASP.NET MVC 3 Beta
9 November 2010 ASP.NET MVC 3 RC
10 December 2010 ASP.NET MVC 3 RC 2
13 January 2011 ASP.NET MVC 3
20 September 2011
ASP.NET MVC 4 Developer
Preview
15 February 2012 ASP.NET MVC 4 Beta
31 May 2012 ASP.NET MVC 4 RC
15 August 2012 ASP.NET MVC 4
30 May 2013 ASP.NET MVC 4 4.0.30506.0
26 June 2013 ASP.NET MVC 5 Preview
23 August 2013 ASP.NET MVC 5 RC 1
17 October 2013 ASP.NET MVC 5
17 January 2014 ASP.NET MVC 5.1
10 February 2014 ASP.NET MVC 5.1.1
4 April 2014 ASP.NET MVC 5.1.2
22 June 2014 ASP.NET MVC 5.1.3
The Technologies
36
 Technologies that ASP.NET MVC uses
 C# (OOP, Unit Testing, async, etc.)
 HTML(5) and CSS
 JavaScript (jQuery, KendoUI, etc.)
 AJAX, Single-page apps
 Databases (MS SQL)
 ORM (Entity Framework and LINQ)
 Web and HTTP
The Tools
 Tools that we need:
 IDE: Visual Studio 2012 (Express for Web)
 JustCode and Web Essentals
 Framework: .NET Framework 4.5
 Web server: IIS 8 (Express)
 Data: Microsoft SQL Sever (Express or LocalDB)
 Web Platform Installer 4.0 will install
everything we need for us
 microsoft.com/web/downloads/platform.aspx
 Install Visual Studio Express 2012 for Web
NuGet package management
38
 Free, open source package management
 Makes it easy to install and update open
source libraries and tools
 Part of Visual Studio 2012
 Configurable package sources
 Simple as adding a reference
 GUI-based package installer
 Package manager console
What’s New in MVC 4 ?
 ASP.NET Web API
 Refreshed and modernized default project
templates
 New mobile project template
 Many new features to support mobile apps
 Enhanced support for asynchronous methods
What’s New in MVC 5 ?
 Attribute routing improvements
 Bootstrap support for editor templates
 Enum support in views
 Unobtrusive validation for
MinLength/MaxLength Attributes
 Supporting the ‘this’ context in Unobtrusive
Ajax
What’s new in MVC 6
Rebuilt from the Ground Up
 MVC, Web API, and Web Pages are merged into
one framework, called MVC 6. The new
framework uses a common set of abstractions for
routing, action selection, filters, model binding,
and so on.
 Dependency injection is built into the framework.
Use your preferred IoC container to register
dependencies.
 vNext is host agnostic. You can host your app in
IIS, or self-host in a custom process. (Web API 2
and SignalR 2 already support self-hosting; vNext
brings this same capability to MVC.)
 vNext is open source and cross platform.
Leaner, Faster
 MVC 6 has no dependency on System.Web.dll. The result is
a leaner framework, with faster startup time and lower
memory consumption.
 vNext apps can use a cloud-optimized runtime and subset of
the .NET Framework. This subset of the framework is about
11 megabytes in size compared to 200 megabytes for the full
framework, and is composed of a collection of NuGet
packages.
 Because the cloud-optimized framework is a collection of
NuGet packages, your app can include only the packages
you actually need. No unnecessary memory, disk space,
loading time, etc.
 Microsoft can deliver updates to the framework on a faster
cadence, because each part can be updated independently.
True Side-by-Side Deployment
 The reduced footprint of the cloud-optimized
runtime makes it practical to deploy the framework
with your app.
 You can run apps side-by-side with different
versions of the framework on the same server.
 Your apps are insulated from framework changes
on the server.
 You can make framework updates for each app on
its own schedule.
 No errors when you deploy to production resulting
from a mismatch between the framework patch
level on the development machine and the
production server.
New Development Experience
 vNext uses the Roslyn compiler to compile
code dynamically.
 You can edit a code file, refresh the browser,
and see the changes without rebuilding the
project.
 Besides streamlining the development
process, dynamic code compilation enables
development scenarios that were not possible
before, such as editing code on the server
using Visual Studio Online (“Monaco”).
 You can choose your own editors and tools.
The ASP.NET MVC framework supports
four different types of filters:
 Authorization filters – Implements
the IAuthorizationFilter attribute.
 Action filters – Implements
the IActionFilter attribute.
 Result filters – Implements
the IResultFilter attribute.
 Exception filters – Implements
the IExceptionFilter attribute.
1 de 45

Recomendados

Discuss About ASP.NET MVC 6 and ASP.NET MVC 5 por
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5Discuss About ASP.NET MVC 6 and ASP.NET MVC 5
Discuss About ASP.NET MVC 6 and ASP.NET MVC 5Aaron Jacobson
885 visualizações13 slides
Asp.net mvc 5 course module 1 overview por
Asp.net mvc 5 course   module 1 overviewAsp.net mvc 5 course   module 1 overview
Asp.net mvc 5 course module 1 overviewSergey Seletsky
2.8K visualizações20 slides
MVC - Introduction por
MVC - IntroductionMVC - Introduction
MVC - IntroductionSudhakar Sharma
8.7K visualizações28 slides
Angular on ASP.NET MVC 6 por
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Noam Kfir
2K visualizações24 slides
Learning ASP.NET 5 and MVC 6 por
Learning ASP.NET 5 and MVC 6Learning ASP.NET 5 and MVC 6
Learning ASP.NET 5 and MVC 6Ido Flatow
6.4K visualizações58 slides
ASP.NET MVC Presentation por
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
23.6K visualizações11 slides

Mais conteúdo relacionado

Mais procurados

Asp.net mvc presentation by Nitin Sawant por
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantNitin Sawant
2.3K visualizações27 slides
ASP .NET MVC por
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
1K visualizações13 slides
ASP.NET Brief History por
ASP.NET Brief HistoryASP.NET Brief History
ASP.NET Brief HistorySudhakar Sharma
1.9K visualizações18 slides
Introduction to ASP.NET MVC por
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVCKhaled Musaied
13.7K visualizações15 slides
ASP.NET MVC 5 - EF 6 - VS2015 por
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015Hossein Zahed
3.4K visualizações148 slides
Introduction to ASP.NET MVC 1.0 por
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0Shiju Varghese
1.6K visualizações28 slides

Mais procurados(19)

Asp.net mvc presentation by Nitin Sawant por Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
Nitin Sawant2.3K visualizações
ASP .NET MVC por eldorina
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
eldorina1K visualizações
ASP.NET Brief History por Sudhakar Sharma
ASP.NET Brief HistoryASP.NET Brief History
ASP.NET Brief History
Sudhakar Sharma1.9K visualizações
Introduction to ASP.NET MVC por Khaled Musaied
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
Khaled Musaied13.7K visualizações
ASP.NET MVC 5 - EF 6 - VS2015 por Hossein Zahed
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed3.4K visualizações
Introduction to ASP.NET MVC 1.0 por Shiju Varghese
Introduction to ASP.NET MVC 1.0Introduction to ASP.NET MVC 1.0
Introduction to ASP.NET MVC 1.0
Shiju Varghese1.6K visualizações
Web api por Sudhakar Sharma
Web apiWeb api
Web api
Sudhakar Sharma17.8K visualizações
TDD with ASP.NET MVC 1.0 por Shiju Varghese
TDD with ASP.NET MVC 1.0TDD with ASP.NET MVC 1.0
TDD with ASP.NET MVC 1.0
Shiju Varghese1.2K visualizações
Asp.net mvc por Er. Kamal Bhusal
Asp.net mvcAsp.net mvc
Asp.net mvc
Er. Kamal Bhusal1.6K visualizações
ASP .Net MVC 5 por Nilachal sethi
ASP .Net MVC 5ASP .Net MVC 5
ASP .Net MVC 5
Nilachal sethi719 visualizações
ASP .net MVC por Divya Sharma
ASP .net MVCASP .net MVC
ASP .net MVC
Divya Sharma5.4K visualizações
ASP.NET MVC 3 por Buu Nguyen
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
Buu Nguyen6.2K visualizações
What's new in asp.net mvc 4 por Simone Chiaretta
What's new in asp.net mvc 4What's new in asp.net mvc 4
What's new in asp.net mvc 4
Simone Chiaretta8.5K visualizações
Introduction to ASP.NET por Rajkumarsoy
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Rajkumarsoy16.9K visualizações
MSDN - ASP.NET MVC por Maarten Balliauw
MSDN - ASP.NET MVCMSDN - ASP.NET MVC
MSDN - ASP.NET MVC
Maarten Balliauw6K visualizações
ASP .NET MVC Introduction & Guidelines por Dev Raj Gautam
ASP .NET MVC Introduction & Guidelines  ASP .NET MVC Introduction & Guidelines
ASP .NET MVC Introduction & Guidelines
Dev Raj Gautam1.2K visualizações
Asp 1a-aspnetmvc por Fajar Baskoro
Asp 1a-aspnetmvcAsp 1a-aspnetmvc
Asp 1a-aspnetmvc
Fajar Baskoro19 visualizações
ASP .NET MVC - best practices por Bohdan Pashkovskyi
ASP .NET MVC - best practicesASP .NET MVC - best practices
ASP .NET MVC - best practices
Bohdan Pashkovskyi391 visualizações

Destaque

Dotnet Basics Presentation por
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics PresentationSudhakar Sharma
18.6K visualizações150 slides
Top 9 c#.net interview questions answers por
Top 9 c#.net interview questions answersTop 9 c#.net interview questions answers
Top 9 c#.net interview questions answersJobinterviews
3.2K visualizações13 slides
.NET Framework Overview por
.NET Framework Overview.NET Framework Overview
.NET Framework OverviewDoncho Minkov
19.3K visualizações48 slides
Introduction to .net framework por
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net frameworkArun Prasad
88.2K visualizações48 slides
Architecture of .net framework por
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net frameworkThen Murugeshwari
98.2K visualizações16 slides
Building Next Generation Web Apps and Services using ASP.NET 5 por
Building Next Generation Web Apps and Services using ASP.NET 5Building Next Generation Web Apps and Services using ASP.NET 5
Building Next Generation Web Apps and Services using ASP.NET 5Shravan Kumar Kasagoni
904 visualizações21 slides

Destaque(17)

Dotnet Basics Presentation por Sudhakar Sharma
Dotnet Basics PresentationDotnet Basics Presentation
Dotnet Basics Presentation
Sudhakar Sharma18.6K visualizações
Top 9 c#.net interview questions answers por Jobinterviews
Top 9 c#.net interview questions answersTop 9 c#.net interview questions answers
Top 9 c#.net interview questions answers
Jobinterviews3.2K visualizações
.NET Framework Overview por Doncho Minkov
.NET Framework Overview.NET Framework Overview
.NET Framework Overview
Doncho Minkov19.3K visualizações
Introduction to .net framework por Arun Prasad
Introduction to .net frameworkIntroduction to .net framework
Introduction to .net framework
Arun Prasad88.2K visualizações
Architecture of .net framework por Then Murugeshwari
Architecture of .net frameworkArchitecture of .net framework
Architecture of .net framework
Then Murugeshwari98.2K visualizações
Building Next Generation Web Apps and Services using ASP.NET 5 por Shravan Kumar Kasagoni
Building Next Generation Web Apps and Services using ASP.NET 5Building Next Generation Web Apps and Services using ASP.NET 5
Building Next Generation Web Apps and Services using ASP.NET 5
Shravan Kumar Kasagoni904 visualizações
C#.net por vnboghani
C#.netC#.net
C#.net
vnboghani783 visualizações
Angular JS por John Temoty Roca
Angular JSAngular JS
Angular JS
John Temoty Roca652 visualizações
Introduction to SignalR por Adam Mokan
Introduction to SignalRIntroduction to SignalR
Introduction to SignalR
Adam Mokan7.1K visualizações
Asp.Net MVC Intro por Stefano Paluello
Asp.Net MVC IntroAsp.Net MVC Intro
Asp.Net MVC Intro
Stefano Paluello7.9K visualizações
Advanced Tips & Tricks for using Angular JS por Simon Guest
Advanced Tips & Tricks for using Angular JSAdvanced Tips & Tricks for using Angular JS
Advanced Tips & Tricks for using Angular JS
Simon Guest19.4K visualizações
Getting Started with Angular JS por Akshay Mathur
Getting Started with Angular JSGetting Started with Angular JS
Getting Started with Angular JS
Akshay Mathur2.6K visualizações
How to implement camera recording for USB webcam or IP camera in C#.NET por Ozeki Informatics Ltd.
How to implement camera recording for USB webcam or IP camera in C#.NETHow to implement camera recording for USB webcam or IP camera in C#.NET
How to implement camera recording for USB webcam or IP camera in C#.NET
Ozeki Informatics Ltd.2.5K visualizações
C#, OOP introduction and examples por agni_agbc
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examples
agni_agbc4K visualizações
Refreshing Your UI with HTML5, Bootstrap and CSS3 por Matt Raible
Refreshing Your UI with HTML5, Bootstrap and CSS3Refreshing Your UI with HTML5, Bootstrap and CSS3
Refreshing Your UI with HTML5, Bootstrap and CSS3
Matt Raible38.4K visualizações
C# OOP Advanced Concepts por agni_agbc
C# OOP Advanced ConceptsC# OOP Advanced Concepts
C# OOP Advanced Concepts
agni_agbc14.7K visualizações
Dotnet Interview Questions por maddinapudi
Dotnet Interview QuestionsDotnet Interview Questions
Dotnet Interview Questions
maddinapudi1.5K visualizações

Similar a MVC 6 Introduction

Asp.net c# MVC-5 Training-Day-1 of Day-9 por
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9AHM Pervej Kabir
923 visualizações39 slides
Jinal desai .net por
Jinal desai .netJinal desai .net
Jinal desai .netrohitkumar1987in
321 visualizações4 slides
Asp.net With mvc handson por
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
454 visualizações64 slides
Asp.net mvc por
Asp.net mvcAsp.net mvc
Asp.net mvcTaranjeet Singh
248 visualizações21 slides
Session 1 por
Session 1Session 1
Session 1Asif Atick
521 visualizações10 slides
Introduction To Mvc por
Introduction To MvcIntroduction To Mvc
Introduction To MvcVolkan Uzun
2.4K visualizações28 slides

Similar a MVC 6 Introduction(20)

Asp.net c# MVC-5 Training-Day-1 of Day-9 por AHM Pervej Kabir
Asp.net c# MVC-5 Training-Day-1 of Day-9Asp.net c# MVC-5 Training-Day-1 of Day-9
Asp.net c# MVC-5 Training-Day-1 of Day-9
AHM Pervej Kabir923 visualizações
Jinal desai .net por rohitkumar1987in
Jinal desai .netJinal desai .net
Jinal desai .net
rohitkumar1987in321 visualizações
Asp.net With mvc handson por Prashant Kumar
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
Prashant Kumar454 visualizações
Asp.net mvc por Taranjeet Singh
Asp.net mvcAsp.net mvc
Asp.net mvc
Taranjeet Singh248 visualizações
Session 1 por Asif Atick
Session 1Session 1
Session 1
Asif Atick521 visualizações
Introduction To Mvc por Volkan Uzun
Introduction To MvcIntroduction To Mvc
Introduction To Mvc
Volkan Uzun2.4K visualizações
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web... por SoftServe
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe - "ASP.NET MVC як наступний крок у розвитку технології розробки Web...
SoftServe1.2K visualizações
ASP.NET MVC Fundamental por ldcphuc
ASP.NET MVC FundamentalASP.NET MVC Fundamental
ASP.NET MVC Fundamental
ldcphuc4.9K visualizações
MVC 4 por Vasilios Kuznos
MVC 4MVC 4
MVC 4
Vasilios Kuznos354 visualizações
Asp.Net MVC3 - Basics por Saravanan Subburayal
Asp.Net MVC3 - BasicsAsp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
Saravanan Subburayal5.4K visualizações
Using MVC with Kentico 8 por Thomas Robbins
Using MVC with Kentico 8Using MVC with Kentico 8
Using MVC with Kentico 8
Thomas Robbins4.2K visualizações
MVC por akshin
MVCMVC
MVC
akshin2K visualizações
Mvc por Furqan Ashraf
MvcMvc
Mvc
Furqan Ashraf845 visualizações
Mvc por abhigad
MvcMvc
Mvc
abhigad581 visualizações
Aspnetmvc 1 por Fajar Baskoro
Aspnetmvc 1Aspnetmvc 1
Aspnetmvc 1
Fajar Baskoro2K visualizações
Technoligent providing custom ASP.NET MVC development services por Aaron Jacobson
Technoligent providing custom ASP.NET MVC development servicesTechnoligent providing custom ASP.NET MVC development services
Technoligent providing custom ASP.NET MVC development services
Aaron Jacobson878 visualizações
ASP.NET Presentation por Rasel Khan
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
Rasel Khan2.5K visualizações
ASP.NET MVC as the next step in web development por Volodymyr Voytyshyn
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web development
Volodymyr Voytyshyn2.7K visualizações
Programming is Fun with ASP.NET MVC por Ian Carnaghan
Programming is Fun with ASP.NET MVCProgramming is Fun with ASP.NET MVC
Programming is Fun with ASP.NET MVC
Ian Carnaghan10.7K visualizações
Head first asp.net mvc 2.0 rtt por Lanvige Jiang
Head first asp.net mvc 2.0 rttHead first asp.net mvc 2.0 rtt
Head first asp.net mvc 2.0 rtt
Lanvige Jiang3.6K visualizações

Último

Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptx por
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCollective Bargaining and Understanding a Teacher Contract(16793704.1).pptx
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCenter for Integrated Training & Education
106 visualizações57 slides
12.5.23 Poverty and Precarity.pptx por
12.5.23 Poverty and Precarity.pptx12.5.23 Poverty and Precarity.pptx
12.5.23 Poverty and Precarity.pptxmary850239
381 visualizações30 slides
MUET Newsletter Vol-IX, Issue-III, 2023 por
MUET Newsletter Vol-IX, Issue-III, 2023MUET Newsletter Vol-IX, Issue-III, 2023
MUET Newsletter Vol-IX, Issue-III, 2023Mehran University of Engineering & Technology, Jamshoro
139 visualizações16 slides
Berry country.pdf por
Berry country.pdfBerry country.pdf
Berry country.pdfMariaKenney3
75 visualizações12 slides
NodeJS and ExpressJS.pdf por
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdfArthyR3
48 visualizações17 slides
Meet the Bible por
Meet the BibleMeet the Bible
Meet the BibleSteve Thomason
78 visualizações80 slides

Último(20)

12.5.23 Poverty and Precarity.pptx por mary850239
12.5.23 Poverty and Precarity.pptx12.5.23 Poverty and Precarity.pptx
12.5.23 Poverty and Precarity.pptx
mary850239381 visualizações
Berry country.pdf por MariaKenney3
Berry country.pdfBerry country.pdf
Berry country.pdf
MariaKenney375 visualizações
NodeJS and ExpressJS.pdf por ArthyR3
NodeJS and ExpressJS.pdfNodeJS and ExpressJS.pdf
NodeJS and ExpressJS.pdf
ArthyR348 visualizações
Meet the Bible por Steve Thomason
Meet the BibleMeet the Bible
Meet the Bible
Steve Thomason78 visualizações
Java Simplified: Understanding Programming Basics por Akshaj Vadakkath Joshy
Java Simplified: Understanding Programming BasicsJava Simplified: Understanding Programming Basics
Java Simplified: Understanding Programming Basics
Akshaj Vadakkath Joshy653 visualizações
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv... por Taste
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Creative Restart 2023: Leonard Savage - The Permanent Brief: Unearthing unobv...
Taste55 visualizações
The Accursed House by Émile Gaboriau por DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta251 visualizações
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37 por MysoreMuleSoftMeetup
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37
Payment Integration using Braintree Connector | MuleSoft Mysore Meetup #37
MysoreMuleSoftMeetup50 visualizações
Papal.pdf por MariaKenney3
Papal.pdfPapal.pdf
Papal.pdf
MariaKenney368 visualizações
Narration lesson plan por TARIQ KHAN
Narration lesson planNarration lesson plan
Narration lesson plan
TARIQ KHAN75 visualizações
BUSINESS ETHICS MODULE 1 UNIT I_A.pdf por Dr Vijay Vishwakarma
BUSINESS ETHICS MODULE 1 UNIT I_A.pdfBUSINESS ETHICS MODULE 1 UNIT I_A.pdf
BUSINESS ETHICS MODULE 1 UNIT I_A.pdf
Dr Vijay Vishwakarma40 visualizações
11.30.23A Poverty and Inequality in America.pptx por mary850239
11.30.23A Poverty and Inequality in America.pptx11.30.23A Poverty and Inequality in America.pptx
11.30.23A Poverty and Inequality in America.pptx
mary850239130 visualizações
Jibachha publishing Textbook.docx por DrJibachhaSahVetphys
Jibachha publishing Textbook.docxJibachha publishing Textbook.docx
Jibachha publishing Textbook.docx
DrJibachhaSahVetphys54 visualizações
Nelson_RecordStore.pdf por BrynNelson5
Nelson_RecordStore.pdfNelson_RecordStore.pdf
Nelson_RecordStore.pdf
BrynNelson546 visualizações
Create a Structure in VBNet.pptx por Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P86 visualizações
CUNY IT Picciano.pptx por apicciano
CUNY IT Picciano.pptxCUNY IT Picciano.pptx
CUNY IT Picciano.pptx
apicciano64 visualizações
MercerJesse3.0.pdf por jessemercerail
MercerJesse3.0.pdfMercerJesse3.0.pdf
MercerJesse3.0.pdf
jessemercerail152 visualizações

MVC 6 Introduction

  • 4. „ First learn rules and physical requirements – e.g., names of pieces, legal movements, chess board geometry and orientation, etc. „ Then learn principles – e.g., relative value of certain pieces, strategic value of center squares, power of a threat, etc. „ However, to become a master of chess, one must study the games of other masters – These games contain patterns that must be understood, memorized, and applied repeatedly „There are hundreds of these patterns
  • 5. Becoming a Software Designer Master
  • 6. First learn the rules – e.g., the algorithms, data structures and languages of software „ Then learn the principles – e.g., structured programming, modular programming, object oriented programming, generic programming, etc. „ However, to truly master software design, one must study the designs of other masters – These designs contain patterns must be understood, memorized, and applied repeatedly „
  • 7. Design Patterns Design patterns are solutions to software design problems you find again and again in real-world application development. Patterns are about reusable designs and interactions of objects..
  • 8. The 23 Gang of Four (GoF) patterns are generally considered the foundation for all other patterns. They are categorized in three groups:  Creational,  Structural, and  Behavioral
  • 9. Creational Patterns Abstract Factory Creates an instance of several families of classes Builder Separates object construction from its representation Factory Method Creates an instance of several derived classes Prototype A fully initialized instance to be copied or cloned Singleton A class of which only a single instance can exist
  • 10. Structural Patterns Adapter Match interfaces of different classes Bridge Separates an object’s interface from its implementation Composite A tree structure of simple and composite objects Decorator Add responsibilities to objects dynamically Facade A single class that represents an entire subsystem Flyweight A fine-grained instance used for efficient sharing Proxy An object representing another object
  • 11. Behavioral Patterns Chain of Resp. A way of passing a request between a chain of objects Command Encapsulate a command request as an object Interpreter A way to include language elements in a program Iterator Sequentially access the elements of a collection Mediator Defines simplified communication between classes Memento Capture and restore an object's internal state Observer A way of notifying change to a number of classes State Alter an object's behavior when its state changes Strategy Encapsulates an algorithm inside a class Template Method Defer the exact steps of an algorithm to a subclass Visitor Defines a new operation to a class without change
  • 12. The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating Web applications.
  • 13. The MVC Pattern 13  Model–view–controller (MVC) is a software architecture pattern  Originally formulated in the late 1970s by Trygve Reenskaug as part of the Smalltalk  Code reusability and separation of concerns  Originally developed for desktop, then adapted for internet applications
  • 16. Model 16  Set of classes that describes the data we are working with as well as the business  Rules for how the data can be changed and manipulated  May contain data validation rules  Often encapsulate data stored in a database as well as code used to manipulate the data  Most likely a Data Access Layer of some kind  Apart from giving the data objects, it doesn't have significance in the framework
  • 17. View 17  Defines how the application’s user interface (UI) will be displayed  May support master views (layouts) and sub- views (partial views or controls)  Web: Template to dynamically generate HTML  Controlled by View Engines
  • 18. Controller 18  The core MVC component  Process the requests with the help of views and models  A set of classes that handles  Communication from the user  Overall application flow  Application-specific logic  Every controller has one or more "Actions"
  • 19. MVC Steps 19  Incoming request routed to Controller For web: HTTP request  Controller processes request and creates presentation Model Controller also selects appropriate result (view)  Model is passed to View  View transforms Model into appropriate output format (HTML)  Response is rendered (HTTP Response)
  • 21. 21 MVC Pattern in ASP.NET MVC
  • 23. Request Flow Request View Controller Model HTTP Select ViewHTML Routing Select Controller
  • 24. Stage Details Receive first request for the application In the Global.asax file, Route objects are added to the RouteTable object. Perform routing The UrlRoutingModule module uses the first matching Route object in theRouteTable collection to create the RouteData object, which it then uses to create aRequestContext (IHttpContext) object. Create MVC request handler The MvcRouteHandler object creates an instance of the MvcHandler class and passes it the RequestContext instance. Create controller The MvcHandler object uses the RequestContext instance to identify theIControllerFactory object (typically an instance of the DefaultControllerFactoryclass) to create the controller instance with. Execute controller The MvcHandler instance calls the controller s Execute method. Invoke action Most controllers inherit from the Controller base class. For controllers that do so, theControllerActionInvoker object that is associated with the controller determines which action method of the controller class to call, and then calls that method. Execute result A typical action method might receive user input, prepare the appropriate response data, and then execute the result by returning a result type. The built-in result types that can be executed include the following: ViewResult (which renders a view and is the most-often used result type), RedirectToRouteResult, RedirectResult,Content
  • 26. MVC Frameworks 26  CakePHP (PHP)  CodeIgniter (PHP)  Spring (Java)  Perl: Catalyst, Dancer  Python: Django, Flask, Grok  Ruby: Ruby on Rails, Camping, Nitro, Sinatra  JavaScript: AngularJS, JavaScriptMVC, Spine  ASP.NET MVC (.NET Framework)
  • 27. ASP.NET Web Forms  Stable and mature, supported by heaps of third party controls and tools  Event driven web development  Postbacks  Viewstate  Less control over the HTML  Hard to test  Rapid development
  • 28. ASP.NET MVC 28  Runs on top of ASP.NET  Not a replacement for WebForms  Leverage the benefits of ASP.NET  Embrace the web  User/SEO friendly URLs, HTML 5, SPA  Adopt REST concepts  Uses MVC pattern  Conventions and Guidance  Separation of concerns
  • 29. ASP.NET MVC (2) 29  Tight control over markup  Testable  Loosely coupled and extensible  Convention over configuration  Razor view engine  One of the greatest view engines  With intellisense, integrated in Visual Studio  Reuse of current skills (C#, LINQ, HTML, etc.)  Application-based (not scripts like PHP)
  • 30. Separation of Concerns 30  Each component has one responsibility  SRP – Single Responsibility Principle  DRY – Don’t Repeat Yourself  More easily testable  TDD – Test-driven development  Helps with concurrent development  Performing tasks concurrently  One developer works on views  Another works on controllers
  • 31. Extensible 31  Replace any component of the system  Interface-based architecture  Almost anything can be replaced or extended  Model binders (request data to CLR objects)  Action/result filters (e.g. OnActionExecuting)  Custom action result types  View engine (Razor, WebForms, NHaml, Spark)  View helpers (HTML, AJAX, URL, etc.)  Custom data providers (ADO.NET), etc.
  • 32. Clean URLs 32  REST-like  /products/update  /blog/posts/2013/01/28/mvc-is-cool  Friendlier to humans  /product.aspx?catId=123 or post.php?id=123  Becomes /products/chocolate/  Friendlier to web crawlers  Search engine optimization (SEO)
  • 33. ASP.NET Web Forms ASP.NET MVC Asp.Net Web Form follow a traditional event driven development model. Asp.Net MVC is a lightweight and follow MVC (Model, View, Controller) pattern based development model. Asp.Net Web Form has server controls. Asp.Net MVC has html helpers. Asp.Net Web Form supports view state for state management at client side. Asp.Net MVC does not support view state. Asp.Net Web Form has file-based URLs means file name exist in the URLs must have its physically existence. Asp.Net MVC has route-based URLs means URLs are divided into controllers and actions and moreover it is based on controller not on physical file. Asp.Net Web Form follows Web Forms Syntax Asp.Net MVC follow customizable syntax (Razor as default) In Asp.Net Web Form, Web Forms(ASPX) i.e. views are tightly coupled to Code behind(ASPX.CS) i.e. logic. In Asp.Net MVC, Views and logic are kept separately. Asp.Net Web Form has Master Pages for consistent look and feels. Asp.Net MVC has Layouts for consistent look and feels. Asp.Net Web Form has User Controls for code re-usability. Asp.Net MVC has Partial Views for code re- usability. Asp.Net Web Form has built-in data controls and best for rapid development with powerful data access. Asp.Net MVC is lightweight, provide full control over markup and support many features that allow fast & agile development. Hence it is best for developing interactive web application with latest web standards. Asp.Net Web Form is not Open Source. Asp.Net Web MVC is an Open Source.
  • 34. The ASP.NET MVC History 34
  • 35. Date Version 10 December 2007 ASP.NET MVC 13 March 2009 ASP.NET MVC 1.0 16 December 2009 ASP.NET MVC 2 RC 4 February 2010 ASP.NET MVC 2 RC 2 10 March 2010 ASP.NET MVC 2 6 October 2010 ASP.NET MVC 3 Beta 9 November 2010 ASP.NET MVC 3 RC 10 December 2010 ASP.NET MVC 3 RC 2 13 January 2011 ASP.NET MVC 3 20 September 2011 ASP.NET MVC 4 Developer Preview 15 February 2012 ASP.NET MVC 4 Beta 31 May 2012 ASP.NET MVC 4 RC 15 August 2012 ASP.NET MVC 4 30 May 2013 ASP.NET MVC 4 4.0.30506.0 26 June 2013 ASP.NET MVC 5 Preview 23 August 2013 ASP.NET MVC 5 RC 1 17 October 2013 ASP.NET MVC 5 17 January 2014 ASP.NET MVC 5.1 10 February 2014 ASP.NET MVC 5.1.1 4 April 2014 ASP.NET MVC 5.1.2 22 June 2014 ASP.NET MVC 5.1.3
  • 36. The Technologies 36  Technologies that ASP.NET MVC uses  C# (OOP, Unit Testing, async, etc.)  HTML(5) and CSS  JavaScript (jQuery, KendoUI, etc.)  AJAX, Single-page apps  Databases (MS SQL)  ORM (Entity Framework and LINQ)  Web and HTTP
  • 37. The Tools  Tools that we need:  IDE: Visual Studio 2012 (Express for Web)  JustCode and Web Essentals  Framework: .NET Framework 4.5  Web server: IIS 8 (Express)  Data: Microsoft SQL Sever (Express or LocalDB)  Web Platform Installer 4.0 will install everything we need for us  microsoft.com/web/downloads/platform.aspx  Install Visual Studio Express 2012 for Web
  • 38. NuGet package management 38  Free, open source package management  Makes it easy to install and update open source libraries and tools  Part of Visual Studio 2012  Configurable package sources  Simple as adding a reference  GUI-based package installer  Package manager console
  • 39. What’s New in MVC 4 ?  ASP.NET Web API  Refreshed and modernized default project templates  New mobile project template  Many new features to support mobile apps  Enhanced support for asynchronous methods
  • 40. What’s New in MVC 5 ?  Attribute routing improvements  Bootstrap support for editor templates  Enum support in views  Unobtrusive validation for MinLength/MaxLength Attributes  Supporting the ‘this’ context in Unobtrusive Ajax
  • 41. What’s new in MVC 6 Rebuilt from the Ground Up  MVC, Web API, and Web Pages are merged into one framework, called MVC 6. The new framework uses a common set of abstractions for routing, action selection, filters, model binding, and so on.  Dependency injection is built into the framework. Use your preferred IoC container to register dependencies.  vNext is host agnostic. You can host your app in IIS, or self-host in a custom process. (Web API 2 and SignalR 2 already support self-hosting; vNext brings this same capability to MVC.)  vNext is open source and cross platform.
  • 42. Leaner, Faster  MVC 6 has no dependency on System.Web.dll. The result is a leaner framework, with faster startup time and lower memory consumption.  vNext apps can use a cloud-optimized runtime and subset of the .NET Framework. This subset of the framework is about 11 megabytes in size compared to 200 megabytes for the full framework, and is composed of a collection of NuGet packages.  Because the cloud-optimized framework is a collection of NuGet packages, your app can include only the packages you actually need. No unnecessary memory, disk space, loading time, etc.  Microsoft can deliver updates to the framework on a faster cadence, because each part can be updated independently.
  • 43. True Side-by-Side Deployment  The reduced footprint of the cloud-optimized runtime makes it practical to deploy the framework with your app.  You can run apps side-by-side with different versions of the framework on the same server.  Your apps are insulated from framework changes on the server.  You can make framework updates for each app on its own schedule.  No errors when you deploy to production resulting from a mismatch between the framework patch level on the development machine and the production server.
  • 44. New Development Experience  vNext uses the Roslyn compiler to compile code dynamically.  You can edit a code file, refresh the browser, and see the changes without rebuilding the project.  Besides streamlining the development process, dynamic code compilation enables development scenarios that were not possible before, such as editing code on the server using Visual Studio Online (“Monaco”).  You can choose your own editors and tools.
  • 45. The ASP.NET MVC framework supports four different types of filters:  Authorization filters – Implements the IAuthorizationFilter attribute.  Action filters – Implements the IActionFilter attribute.  Result filters – Implements the IResultFilter attribute.  Exception filters – Implements the IExceptionFilter attribute.