APIs/Data Models (18%) Flashcards

1
Q

True or False. Most of the time, mappers do not apply business logic?

A

True

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

Which requests may contain a query string and a body ?

A

POST, PUT and PATCH

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

From a payload, which kind of object is constructed and passed to the controller?

A

An API Model object

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

Name the 2 attributes that are used to determine which URL an endpoint will respond to?

A

RoutePrefix

Route

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

Which method is declared in the BaseApiController class and is responsible for the whole controller flow?

A

The ExecuteAsync method

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

What is the ExecuteAsync method?

A

It is a simple async wrapper around the synchronous Execute method

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

What is the responsibility of the Execute method from the BaseApiController class?

A

The Execute method is responsible for the whole API call flow.

It interacts with the mapper and the service to apply the business logic

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

Name the 4 steps done by the Execute method of the BaseApiController class

A

Map the API parameter to Service parameter
Call the service with the Service parameter
Map the Service Result back to an API result
Send back the API Result in the response

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

Which are the 3 common strategies adopted when developing custom API endpoints?

A

Simple service + controller (simple method)
Simple service + ExecuteAsync (hybrid method)
Service + Handler Chain (advanced method)

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

The ExecuteAsync method takes 5 generic types as parameters. Name them, in the correct order.

A
Mapper
API Parameter
Service Parameter
Service Result
API Result
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which Object Relational Model (ORM) B2B Commerce uses?

A

B2B Commerce uses Entity Framework Code First version 6

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

Where is the the ODataControllers.tt T4 template located?

A

In the Insite.Admin library

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

Is it possible for developers to extend the existing T4 template?

A

No. I t is recommended to implement a custom T4 template independently. Developers cannot extend the existing T4 template.

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

Describe 2 ways entities can be archived?

A

Setting the DateTime deactivate property to today’s date.

Setting the Boolean archive property to false.

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

How is it possible for a developers to retrieve archived entities?

A

Using the Admin API developers can retrieve archived entities by appending the archivedFilter=1 OData query

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

Which syntax is the Admin API using?

A

The Admin API uses OData syntax

Example:
Admin API return a single object syntax:
/api/v1/admin/products(f88d5c07-eb72-42eb-ab36-a5d201168a49)

Storefront API return a single object syntax:
/api/v1/products/f88d5c07-eb72-42eb-ab36-a5d201168a49

17
Q

Which are here are two ways to retrieve child collections on a RESTful JSON result?

A

Use the expand parameter for the query string
Example: /api/v1/websites(d24h5c07-eb72-42eb-ab36-a5d201168jh5)?$expand=countries

Use the name of the child entity after the slash
Example: /api/v1/websites(d24h5c07-eb72-42eb-ab36-a5d201168jh5)/countries

18
Q

True or False

All of the entities within B2B Commerce will contain a Patch endpoint for the Admin API to update them?

A

True

19
Q

Where are the OData Entities models located?

A

The models are located in the Insite.Data.Entities library

20
Q

What is the root namespace for entity-related components in the B2B Commerce framework?

A

Insite.Data

21
Q

How to create an entity class?

A
  • First create a POCO (Plain Old CLR Object) that extends from Insite.Data.Entities.EntityBase
  • Then add properties with add virtual properties
22
Q

From which library a new mapping class for a newly created entity class should extend?

A

It should extend from Insite.Data.Providers.EntityFramework.EntityMappings.EntityBaseTypeConfiguration

23
Q

How to add an entity class?

A
  • create a POCO (Plain Old CLR Object) that extends from Insite.Data.Entities.EntityBase
  • add virtual properties to the class
24
Q

From what a mapping class must extend a custom entity class to be bootstrapped to the context correctly?

A

From Insite.Data.Providers.EntityFramework.EntityMappings.EntityBaseTypeConfiguration

25
Q

What are the 2 properties and values that must be set to properly for a SQL script to run automatically?

A

Setting the Build Action property of the file to Embedded Resource
Setting the Copy to Output Directory property to Do not copy

26
Q

Which Optimizely optimization can be used to get a collection without tracking?

A) WithNoTracking
B) AsNoTracking
C) GetTableAsNoTracking

A

C) GetTableAsNoTracking

To get a collection without tracking, invoke the GetTableAsNoTracking method on the Repository.

27
Q

Which connection string will have only read/write/execute privileges on all schemas and will no longer be the database owner and will not be allowed to execute SQL scripts or any DDL?

A

InSite.Commerce

28
Q

Which connection string will have database owner rights and be able to do anything on any schema - this connection will be used to execute base scripts?

A

InSite.Commerce.Admin

29
Q

Which connection string will have DDL rights to the Extensions schema only?

A

InSite.Commerce.Extensions

30
Q

Which nuget package is required in your Extensions project to create a custom entity for your custom table?

A

EntityFramework v6.1.3

31
Q

Signing into B2B involves two requests. What are they?

A

one to authenticate with Identity Server and a second to create an B2B session.