/
Introduction to ASP.NET Introduction to ASP.NET

Introduction to ASP.NET - PowerPoint Presentation

collectmcdonalds
collectmcdonalds . @collectmcdonalds
Follow
342 views
Uploaded On 2020-06-29

Introduction to ASP.NET - PPT Presentation

MVC Blogging Engine in 60 minutes Adnan Masood wwwAdnanMasoodcom wwwCodePlexcomYABE About Me aka Shameless Self Promotion Sr Software Engineer Tech Lead for Green Dot Corp Financial Institution ID: 788586

net mvc framework asp mvc net asp framework controller view url model www page testing data concerns class existing

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "Introduction to ASP.NET" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Introduction to ASP.NET MVC Blogging Engine in 60 minutes

Adnan Masood

www.AdnanMasood.com

www.CodePlex.com/YABE

Slide2

About Meaka. Shameless Self Promotion

Sr. Software Engineer / Tech Lead for Green Dot Corp. (Financial Institution)

Design and Develop Connected Systems

Involved with SoCal Dev community, co-founded San Gabriel Valley .NET Developers Group. Published author and speaker.MS. Computer Science, MCPD (Enterprise Developer), MCT, MCSD.NETDoctoral Student - Areas of Interest: Machine learning, Bayesian Inference, Data Mining, Collaborative Filtering, Recommender Systems.Contact at adnanmasood@acm.orgRead my Blog at www.AdnanMasood.comDoing a session in IASA 2008 in San Francisco on Aspect Oriented Programming; for details visit http://www.iasaconnections.com

Slide3

YABEYet another blogging engine

Team

Adnan Masood

Jeff BergmanSean Xiaowww.CodePlex.com/YABEUses Linq to SQL for data accessSyndication Libraries for the RSS/Atom FeedsExperiment in learning MVC

Slide4

Latest Developments in the MVC world

Scott Guthrie, adaptation from

RoR

How does this relate to Visual Studio 2008/.NET 3.5 SP1 Beta?It doesn't. For now ASP.NET MVC is an out-of-band Web downloadable thing. It's bin deployable (meaning you don't HAVE to put them in the GAC) and you don't even need to tell your hosting/ISP. They are what they are - three DLLs in a folder. Bam. MVC Preview 3 will not be affected by having SP1 installed. Preview 3 will include newer privately versioned bin deployable builds of the Routing and Abstractions DLLs. That way these assemblies will not be affected by the versions in the GAC installed by SP1, because they will have different version numbers.

Slide5

MVC vs. “Classic” ASP.NET

Slide6

Ok, so what is this MVC thingy?

It is an ASP.NET framework that performs data exchange by using a REST model versus the

postback

model of classic ASP.NET. Each page is split into two distinct components -controller and view - that operate over the same model of data. This is opposed to the classic code-behind model where no barrier is set that forces you to think in terms of separation of concerns and controllers and views. However, by keeping the code-behind class as thin as possible, and designing the business layer appropriately, a good developer could achieve separation of concerns even without adopting MVC and its overhead. MVC, however, is a model superior to a properly-done code-behind for its inherent support for test-driven development.

Slide7

Model View Controller Pattern

Slide8

More Concrete Model View Controller Pattern

Slide9

Why use ASP.NET MVC?

It enables clean separation of concerns, testability, and TDD by default.  All core contracts within the MVC framework are interface based and easily

mockable

(it includes interface based IHttpRequest/IHttpResponse intrinsics).  You can unit test the application without having to run the Controllers within an ASP.NET process (making unit testing fast).  You can use any unit testing framework you want to-do this testing (including NUnit, MBUnit, MS Test, etc).It is highly extensible and pluggable.  Everything in the MVC framework is designed so that it can be easily replaced/customized (for example: you can optionally plug-in your own view engine, routing policy, parameter serialization, etc).  It also supports using existing dependency injection and IOC container models (Windsor, Spring.Net, NHibernate, etc).It includes a very powerful URL mapping component that enables you to build applications with clean URLs.  URLs do not need to have extensions within them, and are designed to easily support SEO and REST-friendly naming patterns.  For example, I could easily map the /products/edit/4 URL to the "Edit" action of the ProductsController class in my project above, or map the /Blogs/scottgu/10-10-2007/SomeTopic/ URL to a "DisplayPost" action of a BlogEngineController class.The MVC framework supports using the existing ASP.NET .ASPX, .ASCX, and .Master markup files as "view templates" (meaning you can easily use existing ASP.NET features like nested master pages, <%= %> snippets, declarative server controls, templates, data-binding, localization, etc).  It does not, however, use the existing post-back model for interactions back to the server.  Instead, you'll route all end-user interactions to a Controller class instead - which helps ensure clean separation of concerns and testability (it also means no viewstate or page lifecycle with MVC based views).The ASP.NET MVC framework fully supports existing ASP.NET features like forms/windows authentication, URL authorization, membership/roles, output and data caching, session/profile state management, health monitoring, configuration system, the provider architecture, etc.

Slide10

Why MVC is so different?

REST is an architectural pattern that defines how network resources should be defined and addressed in order to gain shorter response times, clear separation of concerns between the front-end and back-end of a networked system. REST is based on three following principles:

An application expresses its state and implements its functionality by acting on logical resources

Each resource is addressed using a specific URL syntaxAll addressable resources feature a contracted set of operations

Slide11

The answer to Url’s Life, 42.

In the MVC Framework, a URL is seen as the mean to address a logical server resource, but not necessarily an ASPX file to parse. So the URLs employed by the pages of an MVC Framework application have a custom format that the application itself mandates. In the end, the MVC Framework employs a centralized HTTP handler that recognizes an application-specific syntax for links. In addition, each addressable resource exposes a well-known set of operations and a uniform interface for executing operations.

Slide12

What? No more postbacks!

The MVC Framework doesn't support classic

postbacks

and viewstate and doesn't consider any URL as the endpoint to a physical server file to parse and compile to a class. In ASP.NET, you have a 1:1 correspondence between a URL and a resource.

Slide13

Why MVC? (links)

The REST-like Aspect of MVC Framework

ASP.NET MVC Framework: An early look

RSS Feed with the new ASP.NET MVC FrameworkMVC, REST, and the Alternative ASP.NET FrameworkASP.NET MVC framework - ready or not

Slide14

Why MVC?

Very Clean separation of Concerns

Unit Testing

Model that leads you down a maintainable path (prevent crappy code)Clean Urls and Html

Slide15

Front Controller

Classic asp.net framework is Page Controller

Map

Urls to classes/controllers instead of Pages

Slide16

Unit Testing

Mock Objects to simulate responses.

Don’t have to go through a page or view

Red/Green Testing

Slide17

Unit Testing

Create instance of controller

controller.ViewEngine

= new TestViewEngine();Uses Mock Objects

Slide18

Features

Routing

Controller

ViewDependency InjectionPluggableInterfaces for all core contracts

Slide19

Url

Url

no longer points to the view/

aspx pageA Url maps to a controller classAllows more flexibility to map UrlsUrl routing engine, Route tableRoutes are tokenized stringsCan use RegEx

Slide20

Route Examples

<Controller>/<Action>/<

Param

>http://domain/Home/CustomerDetail/45Html.Link for creating outbound urlsHtml.Link(<Friendly Name>, <Action>, <Controller>)

Slide21

Controller

IController

Execute(

IHttpContext ctx, RouteData routeData)class MyController : Controller[ControllerAction] attribute

Slide22

View

Similar to existing page

No

postback or view stateNot all page events will fireEditing forms will be more workSeparate page for viewing, editing, and updatingAjax will use UserControls as update panels butrequest still goes through the control

Slide23

Views

View probably shouldn’t directly access data sources or services.

Use the

ViewData which stores the model the view is renderingViewPage<T>, ViewPage

Slide24

Future of the ASP.NET MVC

MVC for the Enterprise

Classic

Asp.Net for quicker implementations

Slide25

References

Download the Latest MVC Preview 3

http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&displaylang=en

ASP.NET MVC Preview 3http://www.hanselman.com/blog/ASPNETMVCPreview3.aspxQuick Start Guideshttp://quickstarts.asp.net/3-5-extensions/mvc/default.aspxUpcoming Changes in Routinghttp://haacked.com/archive/2008/04/10/upcoming-changes-in-routing.aspxScott Guthrie’s Post on ASP.NET MVC Frameworkhttp://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx

Slide26

Questions?

ASP.NET

MVC

is a new paradigm for .NET Developers; a new way to think about programming web application.Any Questions / Comments … feel free to contact adnanmasood@gmail.com Visit www.CodePlex.com/YABEVisit www.AdnanMasood.com