Database Service
A service which handles storing of the Basket in the database
The database service is what handles the retrieval, insertion, updating, and clearing of the UmbCheckout Basket within the database. A Basket is stored only when Store Basket In The Database is on in the configuration, and there is one row per session, site root culture and currency.
You can access the database service by injecting IDatabaseService which can be found within the namespace UmbCheckout.Core.Addons.Interfaces
Every method takes an optional CancellationToken as its last parameter.
GetBasketAsync
Gets the stored Basket for one site root culture and currency
sessionId
The session to retrieve the Basket for
siteRootCulture
The culture of the site root
currencyCode
The 3-letter ISO currency code
Task<Basket?> GetBasketAsync(string sessionId, string? siteRootCulture, string? currencyCode, CancellationToken cancellationToken = default);GetBasketsAsync
Gets every stored Basket for a session (one per site root culture and currency)
Task<IEnumerable<Basket>> GetBasketsAsync(string sessionId, CancellationToken cancellationToken = default);UpdateBasketAsync
Updates the stored Basket. Nothing is written when the Basket hasn't changed, so reading a Basket doesn't extend its expiry.
DeleteBasketAsync
Deletes the stored Basket for one site root culture and currency
DeleteBasketsAsync
Deletes every stored Basket last updated before the date (UTC), and returns how many were deleted
expiryUtc
The date to delete from, in UTC
Last updated