18
ASP.NET MVC4 framework Ivan Marković [email protected] m

MVC4 framework

Embed Size (px)

DESCRIPTION

MVC3 Framework and Entity Framework

Citation preview

Page 1: MVC4 framework

ASP.NET MVC4 framework

Ivan Marković

[email protected]

m

Page 2: MVC4 framework

MVC

Page 3: MVC4 framework

ASP.NET MVC4

Web application framework

Alternate for ASP.NET Web Forms

MVC=Model-View-Controller

Architectural pattern

MVC

Page 4: MVC4 framework

Advantages of an MVC-Based Web

Application

Easier to manage complexity(input logic, business

logic, and UI logic)

Better support for test-driven development(TDD)

Better for large teams of developers

Page 5: MVC4 framework

Model

Page 6: MVC4 framework

Entity framework(EF)

Object relational mapper(ORM) framework for .NET

Eliminates the need for most of the data-access code that developers usually

need to write.

Page 7: MVC4 framework

Entity Framework Development Approaches

Page 8: MVC4 framework

View

Page 9: MVC4 framework

Razor

View Engine for ASP.NET

Optimized arround HTML

Page 10: MVC4 framework

Razor-example

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="utf-8" />

<title>Web Pages Demo</title>

</head>

<body>

<h1>Hello Web Pages</h1>

<p>The time is @DateTime.Now</p>

</body>

</html>

Page 11: MVC4 framework

Advantages:

Compact, Expressive, and Fluid

Easy to Learn

Is not a new language

Works with any Text Editor

Page 12: MVC4 framework

Controller

Page 13: MVC4 framework

The ASP.NET MVC framework maps URLs to classes that are referred to as

controllers

The base class for all controllers is the ControllerBase class

Controller

Page 14: MVC4 framework

Locating the appropriate action method to call and validating that it can be

called.

Getting the values to use as the action method's arguments.

Handling all errors that might occur during the execution of the action method.

The Controller class is responsible for the following

processing stages:

Page 15: MVC4 framework

ASP.NET MVC applications is organized around controllers and action

methods.

The controller defines action methods. Controllers can include as many action

methods as needed.

/[Controller]/[ActionName]/[Parameters]

Action Methods

Page 16: MVC4 framework

MVC3 vs MVC4

Page 17: MVC4 framework

Difference

Enhancements to Default Project Templates

Mobile Project Template

jQuery Mobile, the View Switcher, and Browser Overriding

Page 18: MVC4 framework

Example time