2023 beta - Architecture (20%) Flashcards

1
Q

B2B Commerce is made of building blocks that form the architecture. What kind of building blocks are they?

A

Widgets
Modules
Handlers
Services
Directives
Controllers

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

The development architecture is split across three core libraries. Name them.

A

B2B Commerce.Web
Insite.Module
Insite.Model

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

What is the project type of the B2B Commerce.Web project ?

A

The B2B Commerce.Web project is an ASP.NET MVC application

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

What are the responsibilities of the B2B Commerce.Web application?

A

The web application is responsible for the client side models and services which call the WebAPI layer within each of the Optimizely Modules.

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

In which project (or core library) all widget views, AngularJS directives, AngularJS controllers, and AngularJS services reside?

A

In the B2B Commerce.Web project

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

What is the responsibility of the Insite.Model project?

A

The Insite.Model project handles the Unit of Work, Repository, Domain Services, ContextProvider and persistence of the platform.

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

What are the responsibilities of handlers?

A

Handlers are objects that are responsible for the heavy lifting of objects and processing of business logic.

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

Some handler chains need to use the same logic. Where this logic should be located ?
A - In handlers
B - In pipelies
C - In handler helpers
D - In utilities

A

B - In pipelines.
In previous versions of B2B Commerce, the logic now in pipelines used to exist in handler helpers and utilities. However, the helpers and utilities did not offer an easy way to modify the logic without affecting backwards compatibility. Future service packs and releases could more easily break any custom logic you had managed to inject.

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

Which statements are not true regarding pipelines? Pick 2.
-Pipelines are reusable portions of business logic that are transactional.
-They are made up of one or more classes, called pipes.
-Unlike handler chains, pipelines can be executed wherever the logic is needed.
-Individual pipes within a pipeline can choose to halt execution of the rest of the pipeline by returning an error code or exiting the pipeline.
-Unlike handler chains, the design of pipelines doesn’t allows you to inject your own logic into the pipeline.

A

First and last choice.

Truth is:
-Pipelines are reusable portions of business logic that are NOT transactional.
-Just like handler chains, the design of pipelines allows you to inject your own logic into the pipeline.

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

How to Add a New Pipe to an Existing Pipeline?

A

-Implement the IPipe<TIn, TOut> interface
-Return a result from the “Execute” method
-Specify an order via the “Order” property

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

What is the sole entry point into a pipe?

A

The “Execute” method is the sole entry point into a pipe. This method also contains all of the business logic used by the pipe to complete it’s work.

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

True or false?
All pipes with the same object types will be executed within the same pipeline.

A

True.
This is how a pipe is associated with a pipeline

// These two pipes are part of the same pipeline because they both declare the same parameter and result object types.
public class CalculateOrderLines : IPipe<GetCartPricingParameter, GetCartPricingResult>
public class CalculateOrderTotal : IPipe<GetCartPricingParameter, GetCartPricingResult>

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

How do you replace an existing pipe?

A

To replace an existing pipe, the new pipe must:

-Implement the IPipe<TIn, TOut> interface
-Return a result from the “Execute” method
-Specify an order via the “Order” property
-Be named the same as the pipe being replaced. This is an additional requirement compared to adding a new pipe.

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

How do you exit a pipeline?

A

result.ExitPipeline = true;
if you want to exit and there is no need to indicate an error
OR
result.ResultCode = ResultCode.Error;
if you set the ResultCode to the ResultCode.Error value, the pipeline will exit.

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

Who is responsible for hosting and maintaining the Windows Integration Service (WIS)?

A

The implementation team, in coordination with the customer

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

True or false?
Optimizely does support the use of File Transfer Protocol (FTP) but blocks use of port 21 in the PAWS environment.

A

False
Optimizely does NOT support the use of File Transfer Protocol (FTP) AND blocks use of port 21 in the PAWS environment.

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

B2B Commerce has two ways in which to extend the entities within the platform. What are they?

A

Using the Application Dictionary
Using B2B Commerce .NET objects and methods

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

What would be the solution if you start to see performance degrading for requests that retrieve custom properties?

A

Consider creating a custom endpoint to return only the custom properties you actually need.

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

Which roles are automatically assigned to custom properties?

A

ISC_System
ISC_Integration
ISC_Admin
ISC_ContentAdmin
ISC_User
ISC_ContentApprover
ISC_ContentEditor

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

True or false?
Since the data for the tables and custom properties are in the same entities, you can include custom properties as columns in Admin Console tables.

A

False.
Since the data for the tables and custom properties are in different entities, there is no current way to include custom properties as columns in Admin Console tables.

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

True or false?
Entities are hard coded in B2B Commerce and cannot be created without custom coding.

A

True

22
Q

Custom Properties, by default, are hidden and do not present themselves to the API unless otherwise restricted. Which restriction are required to to be set to change that behavior?

A

This restriction must be set on BOTH the CanEdit and CanView on the permissions.

23
Q

Where is the Site security is managed?

A

Site security is managed within the Application Dictionary. Each entity and their respective Custom Properties can be secured or made visible either at the entity level or the Custom Property level. Security also can be handled at the role level, with individual roles given access to pages or page entities depending on the given use case.

24
Q

True or false?
Custom Properties configured in the Admin Console are stored within the Custom Properties table and are extendable to other platforms, such as an ERP, without development time.

A

False
Custom Properties configured in the Admin Console are stored within the Custom Properties table and are NOT extendable to other platforms, such as an ERP, without development time.

25
Q

Which statements is not true regarding to Entity Framework:
- Entity Framework is open source
- Entity Framework part of the .NET framework
- Entity Framework is one of the relational mapper (ORM) available for B2B Commerce
- Entity Framework simplifies mapping between objects in software to the tables and columns of a relational database.

A

Entity Framework is one of the relational mapper (ORM) available for B2B Commerce is not true.

Truth is:
Entity Framework is the default object relational mapper (ORM) for B2B Commerce.

26
Q

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

A

Insite.Data

27
Q

What the recommended way to access data?

A

The recommended way to access data is to obtain a UnitOfWork object, get the appropriate Repository< T> object, and use that repository to access the entities.

28
Q

Which method should you use to get an entity by Id?

A

The Get method on the corresponding repository.

29
Q

Which method should you use to get a list of entities?

A

To retrieve a list of entities, call the GetTable method, which returns an IQueryable<T> that can be filtered (where), sorted (orderby) or mapped (select).</T>

30
Q

Which option is enabled by default and can be used to retrieve entities and collections of entities related to your entity in the database?

A

By default, lazy loading is enabled. A separate SQL call will be made once the collection is accessed in the code to retrieve these entities.

31
Q

Which approach should you use to load collections ahead of time if you know that you are planning to access them?

A

Use Eager Loading to load collections ahead of time. This approach optimizes the process by making only one SQL call.

32
Q

Which method can you use to eagerly load Custom Properties of an entity?

A

The Expand method provided by Insite.Data.Extensions. You must return an IQueryable to use this method.

33
Q

Which methods can you call after inserting, updating or deleting an entity to commit changes?

A

You will need to call either the Save or SaveAsync method on the UnitOfWork.

34
Q

What is the officially supported best practice and method for changing the data model?

A

The officially supported best practice and method for changing the data model is to add entities to the model. Removing Optimizely tables is not supported.

35
Q

How do you add an entity to add to the data model?

A

First create a POCO (Plain Old CLR Object) that extends from Insite.Data.Entities.EntityBase then add virtual properties. Once you have created your entity class, you must create a mapping class that will extend from Insite.Data.Providers.EntityFramework.EntityMappings.EntityBaseTypeConfiguration< T> for your entity to be bootstrapped to the context correctly. Finally, you will only need to add custom mapping logic to your mapping class if there is a many-to-many relationship between your entity and another

36
Q

What are the requirements to ad an SQL scripts to a solution?

A

Add an SQL file to your Visual Studio Project anywhere in the project’s folder structure. The file should have the format of < year>.< month>.< day>.< increment>.< description>.sql.
Set the Build Action property of the file to Embedded Resource and the Copy to Output Directory property to Do not copy.

37
Q

Which extension method provided by Optimizely should you use to avoid performance degradation with ICollection< T>.Contains() from within a Where clause?

A

WhereContains

38
Q

Which extension method can you use when working with a set of data that doesn’t have change tracking enabled, to improve read performance and to also improve the performance for batch operations?

A

AsNoTracking
To get a collection without tracking, invoke the GetTableAsNoTracking method on the Repository where no updates to the entity are expected.

39
Q

From which class a new new setting sub-group should inherit to be available to manage in the Admin Console?

A

Inheriting from BaseSettingsGroup will make settings available to manage in the Admin Console.

40
Q

How do you decorate a setting class inheriting from BaseSettingsGroup?

A

Decorate the class with the [SettingsGroup] attribute.
Within the attribute constructor, set the PrimaryGroupName to an existing primary settings group and the Label to to any existing sub-groups or new label to display in a group.

41
Q

How to declare a property in a setting class?

A

Set the property to return the value of this.GetValue which is provided by the BaseSettingsGroup class. This method finds the value of this setting in the database. If the value does not exist, the default value is returned. The first argument to the method is the default value.
Decorate the property with the [SettingsField] attribute. Within the attribute constructor, set the DisplayName to configure how the setting is displayed in the Admin Console. Set the Description to display a tooltip next to the label if necessary.

42
Q

What are the rights for the InSite.Commerce connection string?

A

InSite.Commerce 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

43
Q

What are the rights for the InSite.Commerce.Admin connection string?

A

InSite.Commerce.Admin will have database owner rights and be able to do anything on any schema - this connection will be used to execute base scripts

44
Q

What are the rights for the InSite.Commerce.Extensions connection string?

A

InSite.Commerce.Extensions will have DDL rights to the Extensions schema only

45
Q

True or false?
You cannot display custom tables in the Admin Console for console users to view, use or export.

A

True

46
Q

Which statement about custom objects (tables, stored procedures, views, etc) is false?

  • All custom objects must be defined in the dbo schema.
    You have complete control over the Extensions schema, but you can NOT perform any ALTER, CREATE, DROP or TRUNCATE (or any other DDL) statements in any other schema (you can modify and/or load data in other schemas with scripts).
  • Fields should only allow null if it is meaningful to know if the field has not been set.
  • All custom tables must have an Id field that is of type uniqueidentifier that is the primary key with a default value of newsequentialid().
A

All custom objects must be defined in the dbo schema is false

The truth is:
All custom objects must be defined in the Extensions schema.

47
Q

Which statement about custom tables is false?

  • All custom tables must have an Id field that is of type uniqueidentifier that is the primary key with a default value of newsequentialid().
  • All custom tables must have CreatedOn, CreatedBy, ModifiedOn and ModifiedBy fields as defined above that are not nullable and have the specified default values.
  • You should add indexes on fields that you are likely to use to look up data
  • You should add Foreign Key references to tables that are not in the Extensions schema.
A
  • You should add Foreign Key references to tables that are not in the Extensions schema.

Truth is:
You can not add Foreign Key references to tables that are not in the Extensions schema, note there is not a Foreign Key to Product.

48
Q

How do you create a custom entity class that is mapped to a custom SQL table?

A
  • You must add the Table attribute to the class with the table name and the Schema set to “Extensions”.
  • You must inherit from EntityBase, EntityBase will define the Id, CreatedOn, CreatedBy, ModifiedOn, ModifiedBy and CustomProperties collection properties.
  • Required properties should have the Required attribute and string properties in general should have AllowEmptyStrings = true.
  • You should initialize properties where possible (like setting string properties to string.Empty) so they have valid values when you create a new instance of the object.
  • You must have a NaturalKeyField attribute that marks the human readable unique way to look the record up, this can include multiple properties, when there are multiple properties add the NaturalKeyField attribute to each property setting the Order.
  • You should add StringLength attributes that match the definition of the database field.
  • Collection properties should be defined as virtual with type ICollection<T> with an initial value of new HashSet<T>().</T></T>
  • Related objects (if they are also custom) should be defined as virtual and also contain a property for the related entity id named the type of the related entity and Id.
49
Q

Once you have the Entity class for your custom SQL table, you must then create a mapping class. Which interface this mapping class must implement?

A

The mapping class MUST implement the interface ICommerceContextMapping, the best way to accomplish this is to just inherit from our Insite.Data.Providers.EntityFramework.EntityMappings.EntityBaseTypeConfiguration< T> class.

50
Q

What do you need to do if you do not inherit from EntityBaseTypeConfiguration< T>?

A

If you do not inherit from EntityBaseTypeConfiguration< T>, then you must map the CustomProperties collection property yourself.