DI and repositories
Resolve registered interfaces in custom components.
Last updated
Lifetimes
Most commerce services and repositories are scoped. ICache and IMailSender are singletons. Use constructor injection and do not retain scoped services inside singleton components.
Data access
The core infrastructure registers repositories including IProductRepository, IOrderRepository, ICustomerRepository, and IShippingMethodRepository. Prefer service interfaces for business flows and repositories for direct data operations.
Source: OptimusCommerce.UmbracoDependency/OptimusCommerceUmbracoDependencyInfrastructure.cs · Optimus Commerce.Extension 17.94.0