+ All Categories
Home > Software > ASP.net MVC Introduction Wikilogia (nov 2014)

ASP.net MVC Introduction Wikilogia (nov 2014)

Date post: 16-Jul-2015
Category:
Upload: hatem-hamad
View: 125 times
Download: 1 times
Share this document with a friend
32
Hatem Hamad Nov 2014
Transcript

Hatem HamadNov 2014

What is ASP.NET MVC?ASP.NET MVC Power.ASP.NET Web Forms vs. ASP.NET MVCWhat is MVC?ASP.NET MVC Parts:

Model

Controller

View

Router

New Web Application (Presentation Layer).Based on Model-View-Controller Design

Pattern.

Complete control on HTML.Smooth Web 2.0 Development .SEO-friendly URLs.

Easy Test Driven Development (TDD).Stateless.

ASP.NET Web Forms Advantages:▪ Fast Development.

▪ Windows Application Development Experience.▪ Event Driven.

▪ View State.

▪ Web Controls.

Disadvantages:▪ Hard to Control HTML.

▪ Unfriendly URLs.

▪ Single “Form” tag in single page.

▪ Hardly Extensible (Ex: JavaScript Libraries ,CSS , etc..)

ASP.NET MVC Advantages:▪ Model-View-Controller Design Pattern.▪ Web Application Development Experience.▪ Easy to control HTML.▪ Razor view engine▪ One of the greatest view engines▪ With intellisense, integrated in Visual Studio▪ Reuse of current skills (C#, LINQ, HTML, etc.)

▪ Search engine optimization (SEO) URL’s.▪ Adopt REST concepts.

Disadvantages:▪ Stateless.

ASP.NET MVC

References:▪ http://en.wikipedia.org/wiki/

ASP.NET_MVC_Framework

▪ http://www.dotnet-tricks.com/Tutorial/mvc/XWX7210713-A-brief-history-of-Asp.Net-MVC-framework.html

Model–view–controller (MVC) is a software architecture pattern.

Code reusability and separation of concernsOriginally developed for

desktop, then adaptedfor internet applications.

Model:Set of classes that describes the data we are

working with as well as the businessRules for how the data can be

changed and manipulatedMay contain data validation rules

View: Defines how the application’s user interface (UI) will be

displayed Web: Template to dynamically generate HTML

Controller: The core MVC component Process the requests with the help of views and models A set of classes that handles

Communication from the user

Interactions between Model(s) & View(s)

Every controller has one or more "Actions"

Model ( Data Object). Controller (Control Application Actions). View (Renders HTML). Router (URL Mapping).

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)

Helps with concurrent development

Performing tasks concurrently

▪ One developer works on views

▪ Another works on controllers

Almost anything can be replaced or extended

Interface-based architecture

Model binders (request data to CLR objects)

Custom action result types

View engine (Razor, WebForms, NHaml, Spark)

View helpers (HTML, AJAX, URL, etc.)

Custom data providers (ADO.NET), etc.

http://yoursite.com/Security/Login

http://yoursite.com/Products/Details/58

http://yoursite.com/Login

http://yoursite.com/Products/58

http://yoursite.com/Customers/Details.aspx?id=21

http://yoursite.com/Customers/Details/21

Default Value

Regular Expression

URL

REST-like

/products/update

/Wiki/posts/2014/11/28/mvc-is-cool

Friendlier to humans

/product.aspx?catId=123 or post.php?id=123

Becomes /products/chocolate/

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)

Entity Framework and LINQ)

Web and HTTP

Hello World Demo. Single Form Demo. Two Forms Demo. JavaScript Demo. Routers Demo.

Tools that we need: IDE: Visual Studio 2012<2013 more efficient>

(Express for Web)

▪ JustCode and Web Essentals

Framework: .NET Framework 4.5

Web server: IIS 8 (Express)

Data: MS 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

27

All controllers and actions

Configuration file

Application_Start() – The entry point of the application

Static files (CSS, Images, etc.)

JavaScript files (jQuery, Modernizr, knockout, etc.)

View templates

_Layout.cshtml – master page (main template)

Free, open source package management Makes it easy to install and

update open source librariesand tools

Part of Visual Studio 2012 Configurable package sources GUI-based package installer Package manager console

30

Install and update packages as easy as adding a reference

Hatem Hamad

E-mail : [email protected]

LinkedIn: Hatem Hamad


Recommended