Design the application architecture - Objective 1.1: Plan the application layers Flashcards

1
Q

What folder usually contains the model or data classes for an application?

A

The Models folder

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

What is one advantage of placing model classes in a separate assembly?

A

To allow the model classes to be used by more than one application.

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

What is a domain model?

A

It represents the data you work with in the middle tier of an application.

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

What is a view model?

A

It represents the data you work with in the presentation layer. Any data present in the view comes from the view model.

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

What is an input model?

A

It represents the data submitted from the client to the server with each individual HTTP request.

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

What are model binders?

A

A simple way to map posted form data to a type and pass that type to an action method as a parameter.

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

What is the DefaultModelBinder?

A

The default model binder in ASP.Net MVC that automatically maps input values to model properties if the names match exactly.

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

How do you create a custom model binder?

A

Implement the IModelBinder interface.

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

What is one reason to use custom model binders?

A

To support abstract classes and interfaces. The default model binder does not support them.

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

What do controllers do?

A

Handle incoming requests, handle user input and interaction, and execute application logic.

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

What class do controllers inherit from?

A

ControllerBase

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

What are action methods?

A

Methods on a controller that map to the user’s interactions with the server.

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

What is an action result?

A

The outcome from calling an action method.

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

Where is the routing table stored?

A

In the global.asax file.

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

What does routing do in ASP.Net MVC?

A

Maps urls to controllers and action methods.

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

What is the default routing format?

A

{controller}/{action}/{id}

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

What does the routing engine do?

A

Analyze urls and pass control to a route handler.

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

What is a route handler?

A

The route handler finds an HTTP handler or class implementing the IHttpHandler interface to handle the request.

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

What is the default handler in ASP.Net MVC?

A

MvcHandler

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

What does the MvcHandler class do?

A

Extracts the controller name from the request and sends it to a controller factory to return the appropriate controller.

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

How do you create a custom controller factory?

A

Create a class that implements the IControllerFactory interface.

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

What does the ActionName attribute do?

A

Gives an action method a different name.

Ex:
[ActionName(“MyName2”)]
public ActionResult MyName()

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

What does the AcceptVerbs attribute do?

A

Specifies which HTTP verbs an action method will respond to.

Ex:
[AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)]
public ActionResult MyAction()

24
Q

What does the NonAction attribute do?

A

Indicates that a controller method is not an action.

25
Q

What does the OutputCache attribute do?

A

Marks an action method whose output will be cached.

Ex:
[OutputCache(Duration=60)]
public ActionResult MyAction()

26
Q

What does the ValidateInput attribute do?

A

Indicates whether an action method’s parameters must be validated.

Ex:
[ValidateInput(false)]
public ActionResult MyAction()

27
Q

What does the HandleError attribute do?

A

Used for handling exceptions thrown by the action method to which it is applied.

Ex:
[HandleError(View=”DivideByZero”)]
public ActionResult MyAction()

28
Q

How do you create a custom action filter?

A

Create a class that inherits from the ActionFilter class.

29
Q

When should you use asynchronous processing in your action methods?

A

When the action method is long-running, network-bound, or IO-bound, or when you want to allow the user to cancel running the method.

30
Q

How do you make an action method asynchronous?

A

Mark it as async and change its return type to Type<ActionResult>.</ActionResult>

Ex:
public async Task<ActionResult> List()
{
   ...
}
31
Q

What 3 ways can you use asynchronous processing in ASP.Net MVC?

A
  1. Mark an action method as async and change its return type to Task<ActionResult></ActionResult>
  2. Use Tasks inside a synchronous action method.
  3. Load asynchronously from the client using JavaScript to call back to the server.
32
Q

What is an MVC view?

A

The part of the application responsible for display information to the user and receiving the user’s input.

33
Q

What is a strongly-typed view?

A

A view whose @model directive is set to a specific class.

34
Q

What is a view-specific model?

A

A class that is used in the @model directive of a view and is not usually directly related to a domain model.

35
Q

What is a partial view?

A

The ASP.Net MVC version of a user control. Does not include <html> and <head> tags.

36
Q

What is a layout page?

A

The ASP.Net MVC version of a master page. Allows sharing of design across multiple views.

37
Q

What is a scaffold template?

A

A template that creates standard pages as part of the process when creating a project.

38
Q

What is the basic syntax to output text from a model property inside a razor view?

A

@model.PropertyName

39
Q

What is the basic syntax of a code block inside a razor view?

A
@{
// Add code here
}
40
Q

What is the basic syntax of an if statement inside a razor view?

A
@if (article.HasContent)
{
   // Add code or HTML here
}
41
Q

What is the basic syntax of calling a generic method inside a razor view?

A

@(MyClass.MyMethod<MyType>())</MyType>

42
Q

What class does the razor view engine inherit from?

A

BuildManagerViewEngine

43
Q

What is the HTML helper?

A

A class with static methods used in views in order to help generate HTML.

44
Q

Where should validation logic go: client-side or server-side?

A

Both

45
Q

What is scalability?

A

The capability of a system to handle a growing amount of work.

46
Q

What are the two primary ways to scale an application?

A

Horizontally and vertically

47
Q

What is horizontal scaling?

A

Scaling that involves adding or removing additional nodes from a system as demand fluctuates. A load balancer determines which server in the web farm should be called.

48
Q

What are some of the architectural considerations that must be addressed in horizontal scaling?

A

Sessions, caching, and location for storing shared files (if you application provides file management functionality like SharePoint does)

49
Q

What is vertical scaling?

A

Adding resources to a single system including additional CPU’s, memory, or hard drive space.

50
Q

What are some of the architectural considerations that must be addressed in vertical scaling?

A

Threading, input/output (I/O), garbage collection, and availability since any part of the system can be a single point of failure.

51
Q

Which primary way of scaling is ultimately limited and cannot scale beyond a certain point?

A

Vertical

52
Q

What advantages does cloud-based hosting such as Windows Azure provide in terms a scalability?

A

Scalability is immediate and can automatically scale as usage grows. It can also provide highly scalable data storage for relational and NoSQL databases.

53
Q

What are the three ways to manage the creation of a database when using Entity Framework?

A

Database First, Code First, and Model First

54
Q

What is the Database First approach in Entity Framework?

A

Leveraging an existing database schema to create entities.

55
Q

What is the Code First approach in Entity Framework?

A

Creating the object model first and use it to create the database schema.

56
Q

What is the Model First approach in Entity Framework?

A

Creating the object model visually using a tool and use it to create the database schema.

57
Q

Which design pattern is one of the most used to abstract data access in Entity Framework?

A

Repository