Getting Started Flashcards
When was the mvc pattern first introduced?
1970’s using a language called Smalltalk-76
Why is MVC so popular among Microsoft developers?
ASP.NET MVC has a separation of concerns.,
ASP.NET MVC provides testability out of the box.,
ASP.NET MVC has a smaller “View” footprint.
ASP.NET MVC has more control over HTML.
What’s the purpose of the App_Data folder?
it’s meant to hold data for your application (just as the name says). A couple of examples would include any kind of data files (XML, JSON, )
What’s the purpose of the App_Start folder?
The App_Start folder contains the initialization and configuration of different features of your application.
What’s the purpose of the Content folder?
This folder is meant for all of your static content like images and style sheets.
What’s the purpose of the Views/Shared folder?
The Shared folder is meant for any shared cshtml files you need across the website.
What’s the purpose of the Global.asax file?
The Global.asax is meant for the initialization of the web application.
What’s the purpose of the Web.Config file?
The web.config is where you place configuration settings for your application. For new MVC developers, it’s good to know that you can place settings inside the tag and place connection strings inside the tag.
Give a quick overview of a page request in MVC.
Routing
Identification and creation of a controller
Identify and select the method to execute
execute result
data replaced in the view
What are ActionResults?
a way to tell the controller what to return to a View or what to return to the browser. ActionResults are what you want to return when you are done processing your Action method.
What’s the difference between a ViewResult and an ActionResult?
ViewResult is a type of ActionResult. ViewResult is inherited from an ActionResult. There are a number of additional ActionResults
What is an ActionFilter?
an attribute that is attached to a controller or action method to perform a certain task.
What is ViewData?
Defined as a dictionary object in the controller class, the ViewData assigns a key/value pair to pass the data over to the View.
Since this is part of the controller class, we do not need to explicitly pass it to the View. It will automatically send it over. Not strongly typed I don’t think
What does the @ symbol do in the view for Razor
You need to prefix your code with an @ symbol to display any data from your models.
What is ViewBag?
ViewBag is a little bit better when it comes to passing data. It wraps the ViewData and makes the object type dynamic so we can immediately find it in our View.