Helpers and utilities
Helpers and utilities
You can use these classes in most places in the application where server-side extensions are used. DateTimeProvider MessageProvider ReadPdf You can use these classes in most places in the application, but are also used in handlers and pipes.
DateTimeProvider
A provider that returns the current DateTimeOffset for the application. This provider should be used whenever you need to get the current date or time, rather than using the standard DateTime or DateTimeOffset classes.
DefaultDateTimeProvider
The default date time provider. This provider should not be used directly because it is a specific implementation.
IAuthenticationService
The Authentication abstraction layer. Gets the identity for the currently authenticated user.
ICookieManager
This is a wrapper class that allows you to more easily manipulate HTTP cookies on the server. Returns the value of a cookie in the HTTP request.
IJobLogger
A class that is capable of writing log messages during the execution of an integration job. Writes a log message for a missing lookup value.
ISiteContext
The context for the current Storefront session. The context includes objects like the current bill-to and ship-to customers, language, currency, website, and user.
IUnitOfWork
The IUnitOfWork interface is the abstraction layer to the object session management of the system. The first time the UnitOfWork is accessed, it will create an instance of the UnitOfWork in HttpContext.
MessageProvider
The provider for accessing Site Messages configured in the Admin Console. Using this provider also gives the additional benefit of making unit testing much easier.
ReadPdf utility
You can use the ReadPdf utility in cases where customers want to take in a link to a PDF file stored in userfiles (media library) and programmatically extract and return the text from the PDF. To read the text from a PDF file, you need to modify your customer API controller by adding a method to be called asynchronously with or without a CancellationToken.
DataSet table and column names
Many times integration jobs will use a DataSet to store data in memory. These data sets are used for a variety of purposes, including to load data from Configured Commerce before a job begins and report data back to Configured Commerce from an external system, like an ERP.