Getting Started Flashcards

1
Q

When was the mvc pattern first introduced?

A

1970’s using a language called Smalltalk-76

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is MVC so popular among Microsoft developers?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the purpose of the App_Data folder?

A

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, )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the purpose of the App_Start folder?

A

The App_Start folder contains the initialization and configuration of different features of your application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What’s the purpose of the Content folder?

A

This folder is meant for all of your static content like images and style sheets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What’s the purpose of the Views/Shared folder?

A

The Shared folder is meant for any shared cshtml files you need across the website.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What’s the purpose of the Global.asax file?

A

The Global.asax is meant for the initialization of the web application.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What’s the purpose of the Web.Config file?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Give a quick overview of a page request in MVC.

A

Routing
Identification and creation of a controller
Identify and select the method to execute
execute result
data replaced in the view

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are ActionResults?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What’s the difference between a ViewResult and an ActionResult?

A

ViewResult is a type of ActionResult. ViewResult is inherited from an ActionResult. There are a number of additional ActionResults

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an ActionFilter?

A

an attribute that is attached to a controller or action method to perform a certain task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is ViewData?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the @ symbol do in the view for Razor

A

You need to prefix your code with an @ symbol to display any data from your models.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is ViewBag?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is TempData?

A

another type of dictionary in the controller called TempData. TempData is set once and when the request and response are complete, it is removed and never used again.

17
Q

How do you redirect to a new action?

A

RedirectToAction(‘actionName’)

18
Q

What is ViewModel?

A

ViewModel is strictly a container to hold Models for the View. It’s just a container to transport the data. ViewModels are different. When you pass a ViewModel from a controller to a View, you have to pass it through the View() method at the end of your Action method. In your View, you need to include the model type at the very top. This explains to the Razor ViewEngine what objects this view will use. The ViewModel method of passing data provides a solid way to build your Views using strong-typed objects instead of “magic-strings” or dynamic objects.

19
Q

What is the ModelBinder?

A

is available to map all of the form data from the View into the current ViewModel and pass that into your controller.

20
Q

What are HtmlHelpers? Give an example.

A

HtmlHelpers return generated HTML or Views.

@Html.TextBox(“FirstName”) ->

21
Q

What are controller actions?

A

Public methods of our controllers.

22
Q

What are action filters?

A

Introduce pre and post processing to actions

23
Q

What is an ActionName attribute?

A

It’s an attribute you put on a action method to alias the method.

24
Q

What is the importance of _ViewStart.cshtml

A

It will run before any of the other views in the application. You can register Layout settings in here.