Skip to content

Database Service

The database service is what handles the insertion, updating, and clearing of the UmbCheckout Basket within the database. Clearing a Basket also deletes its stored copy.

You can access the database service by injecting IDatabaseService which can be found within the namespace UmbCheckout.Core.Addons.Interfaces

Every method also has an overload that takes a CancellationToken as its last parameter (see Cancellation Tokens). UpdateBasket(sessionId, basket), DeleteBasket(sessionId, siteRootCulture, currencyCode) and DeleteBaskets(expiryDateTime) without a token are [Obsolete], scheduled for removal in 17.1.

Updates the stored Basket

Parameters:

Name Detail
sessionId The session to retrieve the Basket for
basket The Basket to be stored
Task<Basket> UpdateBasket(string sessionId, Basket basket);

Deleted the stored Basket

Parameters:

Name Detail
sessionId The session to delete the Basket for
Task DeleteBasket(string sessionId);

Deleted all of the stored Baskets older than the specified days

Parameters:

Name Detail
expiryDateTime The days to delete from
Task DeleteBaskets(DateTime expiryDateTime);