---
title: "Service provider"
slug: "service-provider"
abstract: ""
---
# Service provider

Each service layer has its own interface that you can customize. These providers contain the service methods for interacting with the appropriate subsystem. All service providers must inherit from the `ServiceProvider` class and we recommend that you have a generics version of the class in which each service method is generics based.

Sample service method:

```csharp
public virtual GetCartsResult GetCarts([NotNull] GetCartsRequest request)
{
return this.RunPipeline<GetCartsRequest, GetCartsResult>(PipelineName.GetCarts, request);
}

```

Generics extension method example:

```csharp
public static TGetCartsResult GetCarts<TGetCartsRequest, TGetCartsResult>([NotNull] this CartServiceProvider cartProvider, [NotNull] TGetCartsRequest request)
where TGetCartsRequest : GetCartsRequest
where TGetCartsResult : GetCartsResult, new()
{
return cartProvider.RunPipeline<GetCartsRequest, TGetCartsResult>(PipelineName.GetCarts, request);
}

```

If an existing service provider requires a new service method, consider extending the service provider and adding the new method instead of creating a new service provider. The following lists the various subsystems and their service providers:

- Shopping Cart

    `Sitecore.Commerce.Services.Carts.CartServiceProvider`

- Orders

    `Sitecore.Commerce.Services.Orders.OrderServiceProvider`

- Pricing

    `Sitecore.Commerce.Services.Prices.PricingServiceProvider`

- Product Synchronization

    `Sitecore.Commerce.Services.Products.ProductSynchronizationProvider`

- Customers and Users

    `Sitecore.Commerce.Services.Customers.CustomerServiceProvider`

- Inventory

    `Sitecore.Commerce.Services.Inventory.InventoryServiceProvider`