Podcast
Questions and Answers
What is the primary key requirement for all custom tables?
What is the primary key requirement for all custom tables?
Which fields in custom tables are required to be non-nullable?
Which fields in custom tables are required to be non-nullable?
What should be considered when deciding if a field should allow null values?
What should be considered when deciding if a field should allow null values?
What is the procedure for re-running a script that has already been executed?
What is the procedure for re-running a script that has already been executed?
Signup and view all the answers
Which fields should likely have indexes added?
Which fields should likely have indexes added?
Signup and view all the answers
What is the primary function of the ProductExtensionCollectionModel constructor?
What is the primary function of the ProductExtensionCollectionModel constructor?
Signup and view all the answers
Which method is responsible for generating collection links based on pagination?
Which method is responsible for generating collection links based on pagination?
Signup and view all the answers
What data structure does ProductExtensions use to store the collection of product extensions?
What data structure does ProductExtensions use to store the collection of product extensions?
Signup and view all the answers
How does the ProductExtensionCollectionModel handle pagination when the current page is greater than 1?
How does the ProductExtensionCollectionModel handle pagination when the current page is greater than 1?
Signup and view all the answers
In the context of the code provided, which of the following is true about the PaginationModel?
In the context of the code provided, which of the following is true about the PaginationModel?
Signup and view all the answers
What is the purpose of changing the data model in the implementation of custom tables?
What is the purpose of changing the data model in the implementation of custom tables?
Signup and view all the answers
Which connection string has database owner rights?
Which connection string has database owner rights?
Signup and view all the answers
What permissions does InSite.Commerce.Extensions have in the database?
What permissions does InSite.Commerce.Extensions have in the database?
Signup and view all the answers
What is the correct naming convention for SQL scripts in the Extensions project?
What is the correct naming convention for SQL scripts in the Extensions project?
Signup and view all the answers
What must be set for a script to be run by the bootstrapper?
What must be set for a script to be run by the bootstrapper?
Signup and view all the answers
Which of the following statements is true regarding custom tables?
Which of the following statements is true regarding custom tables?
Signup and view all the answers
What type of permissions does InSite.Commerce have?
What type of permissions does InSite.Commerce have?
Signup and view all the answers
What is a limitation placed on the InSite.Commerce connection in the cloud implementation?
What is a limitation placed on the InSite.Commerce connection in the cloud implementation?
Signup and view all the answers
What attribute marks a property as a human-readable unique identifier in an entity class?
What attribute marks a property as a human-readable unique identifier in an entity class?
Signup and view all the answers
What should be done when multiple properties require the NaturalKeyField attribute?
What should be done when multiple properties require the NaturalKeyField attribute?
Signup and view all the answers
What is the correct way to define collection properties in an entity class?
What is the correct way to define collection properties in an entity class?
Signup and view all the answers
What must a mapping class implement for proper Entity Framework mapping?
What must a mapping class implement for proper Entity Framework mapping?
Signup and view all the answers
What does the Order parameter in the NaturalKeyField attribute indicate?
What does the Order parameter in the NaturalKeyField attribute indicate?
Signup and view all the answers
What is the purpose of the EntityBaseTypeConfiguration class when creating a mapping class?
What is the purpose of the EntityBaseTypeConfiguration class when creating a mapping class?
Signup and view all the answers
What is a key requirement for creating a WebApi for a custom entity?
What is a key requirement for creating a WebApi for a custom entity?
Signup and view all the answers
What namespace should be used for mapping classes in the provided example?
What namespace should be used for mapping classes in the provided example?
Signup and view all the answers
What is the primary purpose of the Get method in the ProductExtensionsController?
What is the primary purpose of the Get method in the ProductExtensionsController?
Signup and view all the answers
Which parameter allows customization of the number of items returned by the Get method?
Which parameter allows customization of the number of items returned by the Get method?
Signup and view all the answers
What does the Get method return if no ProductExtension is found for the provided productId?
What does the Get method return if no ProductExtension is found for the provided productId?
Signup and view all the answers
What role does the IUnitOfWorkFactory serve in the ProductExtensionsController?
What role does the IUnitOfWorkFactory serve in the ProductExtensionsController?
Signup and view all the answers
How does the controller determine the page number to return in the Get method?
How does the controller determine the page number to return in the Get method?
Signup and view all the answers
Study Notes
Custom table configuration
- Custom tables require three separate connection strings in the connectionStrings.config file for development and cloud environments.
- InSite.Commerce: read/write/execute privileges on all schemas, cannot be the database owner, and cannot execute SQL scripts or DDL.
- InSite.Commerce.Admin: database owner rights and can execute base scripts.
- InSite.Commerce.Extensions: DDL rights to the Extensions schema, read/write/execute sprocs in the whole database, and REFERENCES permission in the DBO schema.
- Custom tables cannot be displayed in the Admin Console for viewing, using, or exporting.
Creating custom tables
- Create a "DatabaseScripts" folder at the root level of your Extensions project.
- Database scripts should be named using the convention YYYY.MM.DD.SS.DescriptiveName.sql.
- Set the Build Action to "Embedded Resource" in the properties window for each script.
- Custom tables must have an
Id
field of typeuniqueidentifier
, a primary key with a default value ofnewsequentialid()
. - Custom tables must include non-nullable
CreatedOn
,CreatedBy
,ModifiedOn
, andModifiedBy
fields with specified default values. - Only allow fields to be nullable if it's meaningful to know if the field hasn't been set.
- Add indexes on fields used for data lookup.
- Foreign Key references can be added to tables in the DBO schema, as the Extensions database user has the REFERENCES permission for that schema.
- The bootstrapper will execute scripts and create entries in the
DatabaseScript
table on site startup. - To re-run a script, drop the custom table, delete the entry from the
DatabaseScript
table, and restart the site. - The bootstrapper will only run the script if an entry for it doesn't already exist in the
DatabaseScript
table. - Define a
NaturalKeyField
attribute to specify the human-readable unique way to look up a record. - Add
StringLength
attributes that match the database field definition. - Collection properties should be defined as virtual with type
ICollection
and an initial value ofnew HashSet()
. - Related objects should be defined as virtual and contain a property for the related entity id, named with the type of the related entity and "Id" (e.g.,
MyCustomEntityId
). - Create a mapping class that implements the
ICommerceContextMapping
interface. - Inherit from the
Insite.Data.Providers.EntityFramework.EntityMappings.EntityBaseTypeConfiguration
class, which implementsICommerceContextMapping
and maps theCustomProperties
collection. - Map the
CustomProperties
collection manually if not inheriting fromEntityBaseTypeConfiguration
.
Creating a WebApi
- Create a RESTful WebApi for the custom entity.
- The API controller should handle CRUD operations for the custom entity.
- The API should return collections of the custom entity in a paged and sorted format.
- Implement a parameter object to handle query string parameters for page, pagesize, and sort.
- The API should return a model object containing navigation links, paging information, and the custom entity objects.
Consuming the WebApi
- The client-side code should consume the WebApi using HTTP requests.
- The client-side code should handle parsing the response from the API.
- The client-side code should handle routing and navigation to different pages and actions based on the response.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers essential aspects of configuring and creating custom tables in InSite Commerce environments. Test your knowledge on connection strings, permissions, script creation conventions, and the specifics of managing custom table visibility within the Admin Console.