CS 415 N-Tier Application Development

bubblemessengerΑσφάλεια

5 Νοε 2013 (πριν από 4 χρόνια και 9 μέρες)

95 εμφανίσεις

CS 415 N
-
Tier Application Development



By Umair Ashraf

June 29 ,2013

National University of Computer and Emerging Sciences

Lecture

# 6


Microsoft

MVC4 Architecture for ASP.NET

Agenda/Contents for Today’s Lecture



Class Activity Solution


MVC3 Framework Review


Creating Model


Concept of Scaffolding


Practical Demonstration


Quiz # 1



Components of ASP.NET MVC3/MVC4


Models

These are the classes that represent the domain you are interested in.

With ASP.NET MVC, this is most likely a Data Access Layer of some kind
using a tool like Entity Framework or NHibernate combined with custom
code containing domain
-
specific logic



View

This is a template to dynamically generate HTML


Controller

This is a special class that manages the relationship between the View and
Model.



Model


The word
model in software development is overloaded to
cover hundreds of different concepts.


You have maturity models, design models, threat models,
and process models. It’s rare to sit through a
development meeting without talking about a model of
one type or another.


Even when you scope the term “model” to the context of
the MVC design pattern, you can still debate the merits of
having a business
-
oriented model object versus a view
-
specific model object

Crafting Model class


public class Album


{


public virtual
int

AlbumId

{ get; set; }


public virtual
int

GenreId

{ get; set; }


public virtual
int

ArtistId

{ get; set; }


public virtual string Title { get; set; }


public virtual decimal Price { get; set; }


public virtual string
AlbumArtUrl

{ get; set; }


public virtual Genre
Genre

{ get; set; }


public virtual Artist
Artist

{ get; set; }


}

What Is Scaffolding?


Scaffolding in ASP.NET MVC can generate the boilerplate code
you need for create, read, update, and

delete (CRUD)
functionality in an application. The scaffolding templates
can examine the type definition for a model (such as the
Album class you’ve created), and then generate a
controller and the controller’s associated views. The
scaffolding knows how to name controllers, how to name
views, what code needs to go in each component, and
also knows where to place all these pieces in the project
for the application to work.

MVC 4 Overview


ASP.NET Web API


Enhancements to default project templates


Mobile project template using equerry Mobile


Display Modes


Task support for Asynchronous Controllers


Bundling and
minification

Project Template Using jQuery Mobile

Creating an ASP.NET MVC 4 Application

Creating an ASP.NET MVC 4 Application

MVC APPLICATION STRUCTURE

MVC4 Project Structure


A Simple Example: The Home Controller

A Simple Example
Output

Creating the New Controller

STRONGLY TYPED VIEWS


Add View Dialog Options

View Scaffold Types

Reference Material



Text Book :Professional ASP.NET MVC4 By WROX

(EBook uploaded on website )


Other References :

http://www.w3schools.com/aspnet/mvc_intro.asp

http://www.asp.net/mvc/tutorials