ASP.NET MVC Web Development Getting Started | www.starwave.nl/mq
Model-View-Controller The MVC Pattern Model-View-Controller Model: data / business rules View: application UI Controller: communication, flow, application-specific logic
The MVC Pattern Model-View-Controller Video: The MVC mindset
MVC applied to Web Frameworks Models: encapsulated data stored in database. F.e. via Entity Framework View: template to dynamically generate HTML Controller: manages relationship between view and model. Responds to user input, talk to model, decides which view to render
ASP.NET MVC specific principles Convention over configuration DRY principle (Don’t repeat yourself) Pluggability Be helpful, but stay out of developers way
ASP.NET MVC 5 overview One ASP.NET Bootstrap templates ASP.NET Scaffolding
MVC application structure
MVC application structure 1/2 DIRECTORY PURPOSE /Controllers Where you put Controller classes that handle URL requests /Models Where you put classes that represent and manipulate data and business objects /Views Where you put UI template fi les that are responsible for rendering output, such as HTML /Scripts Where you put JavaScript library files and scripts (.js)
MVC application structure 2/2 DIRECTORY PURPOSE /fonts The Bootstrap template system includes some custom web fonts, which are placed in this directory /Content Where you put CSS, images, and other site content, other than scripts /App_Data Where you store data files you want to read/write /App_Start Where you put configuration code for features like Routing, bundling, and Web API
Convention over configuration ASP.NET MVC’s conventions: Each controller’s class name ends with Controller and lives in the Controllers directory. There is a single Views directory for all the views of your application. Views that controllers use live in a subdirectory of the Views main directory and are named according to the controller name.
School/huiswerk Voor de volgende les: Vragen? Doorlezen hoofdstuk 1: getting started Vragen?