190 likes | 313 Views
National University of Computer and Emerging Sciences . Lecture # 6 Microsoft MVC4 Architecture for ASP.NET. CS 415 N-Tier Application Development . By Umair Ashraf June 29 ,2013. Agenda/Contents for Today’s Lecture. Class Activity Solution MVC3 Framework Review
E N D
National University of Computer and Emerging Sciences Lecture # 6 MicrosoftMVC4 Architecture for ASP.NET CS 415 N-Tier Application Development By Umair Ashraf June 29 ,2013
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 intAlbumId { get; set; } • public virtual intGenreId { get; set; } • public virtual intArtistId { 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, anddelete (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
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