Class CacheWarehouseInventoryService

Warehouse inventory service wrapper, which handles cache for inventory service, and calles the typed warehouse inventory service when items are not in the cache.

Inheritance
System.Object
CacheWarehouseInventoryService
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Mediachase.Commerce.Inventory
Assembly: Mediachase.Commerce.dll
Version: 10.8.0
Syntax
[Obsolete("Use Mediachase.Commerce.InventoryService.IInventoryService instead. Will remain until at least October 2017.")]
public class CacheWarehouseInventoryService : IWarehouseInventoryService

Constructors

CacheWarehouseInventoryService(TimeSpan, IWarehouseInventoryService)

Initializes a new instance of the CacheWarehouseInventoryService class.

Declaration
public CacheWarehouseInventoryService(TimeSpan cacheInvalidationTimeSpan, IWarehouseInventoryService warehouseInventoryService)
Parameters
Type Name Description
System.TimeSpan cacheInvalidationTimeSpan

The cache invalidation time span.

IWarehouseInventoryService warehouseInventoryService

The warehouse inventory service.

CacheWarehouseInventoryService(TimeSpan, IWarehouseInventoryService, ISynchronizedObjectInstanceCache)

Initializes a new instance of the CacheWarehouseInventoryService class.

Declaration
public CacheWarehouseInventoryService(TimeSpan cacheInvalidationTimeSpan, IWarehouseInventoryService warehouseInventoryService, ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache)
Parameters
Type Name Description
System.TimeSpan cacheInvalidationTimeSpan

The cache invalidation time.

IWarehouseInventoryService warehouseInventoryService

The warehouse inventory service.

EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache synchronizedObjectInstanceCache

The synchronized object instance cache.

Fields

MasterCacheKey

Declaration
protected const string MasterCacheKey = "EP:CacheWarehouseInventoryServiceMasterCacheKey"
Field Value
Type Description
System.String

Properties

SynchronizedObjectInstanceCache

The synchronized object instance cache.

Declaration
protected ISynchronizedObjectInstanceCache SynchronizedObjectInstanceCache { get; }
Property Value
Type Description
EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache

WarehouseInventoryFactoryCachePolicy

The warehouse inventory factory cache policy.

Declaration
protected CacheEvictionPolicy WarehouseInventoryFactoryCachePolicy { get; }
Property Value
Type Description
EPiServer.Framework.Cache.CacheEvictionPolicy

WarehouseInventoryService

The warehouse inventory service.

Declaration
protected IWarehouseInventoryService WarehouseInventoryService { get; }
Property Value
Type Description
IWarehouseInventoryService

Methods

Delete(CatalogKey)

Deletes all inventory records for a specific catalog entry.

Declaration
public virtual void Delete(CatalogKey catalogKey)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(CatalogKey, IWarehouse)

Deletes the single inventory record for a specific catalog entry and warehouse combination.

Declaration
public virtual void Delete(CatalogKey catalogKey, IWarehouse warehouse)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to delete inventory for.

IWarehouse warehouse

The warehouse to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(CatalogKey, IEnumerable<IWarehouse>)

Deletes all inventory records for a specific catalog entry as one or more warehouses.

Declaration
public virtual void Delete(CatalogKey catalogKey, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to delete inventory for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(IWarehouse)

Deletes all inventory records for a specific warehouse.

Declaration
public virtual void Delete(IWarehouse warehouse)
Parameters
Type Name Description
IWarehouse warehouse

The warehouse to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(IEnumerable<CatalogKey>)

Deletes all inventory records for one or more catalog entries.

Declaration
public virtual void Delete(IEnumerable<CatalogKey> catalogKeys)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(IEnumerable<CatalogKey>, IWarehouse)

Deletes all inventory records for one or more catalog entries at a specific warehouse.

Declaration
public virtual void Delete(IEnumerable<CatalogKey> catalogKeys, IWarehouse warehouse)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to delete inventory for.

IWarehouse warehouse

The warehouse to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>)

Deletes all inventory records for one or more catalog entries at one or more warehouses.

Declaration
public virtual void Delete(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to delete inventory for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Delete(IEnumerable<IWarehouse>)

Deletes all inventory records for a specific warehouse.

Declaration
public virtual void Delete(IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouse to delete inventory for.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

ExecuteAndClearCache(Action)

Executes the action and clears the cache.

Declaration
protected virtual void ExecuteAndClearCache(Action action)
Parameters
Type Name Description
System.Action action

ExecuteGet(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, Func<IWarehouseInventory>)

Tries to get the 'get' result from cache. If the result isn't in the cache, the action will be executed, and the result will be stored in the cache.

Declaration
protected virtual IWarehouseInventory ExecuteGet(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, Func<IWarehouseInventory> action)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.Func<IWarehouseInventory> action

The action to perform when result is not in the cache.

Returns
Type Description
IWarehouseInventory

The item received from cache, or from the internal warehouse inventory service.

ExecuteGetTotal(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, Func<IWarehouseInventory>)

Tries to get the 'total' result from cache. If the result isn't in the cache, the action will be executed, and the result will be stored in the cache.

Declaration
protected virtual IWarehouseInventory ExecuteGetTotal(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, Func<IWarehouseInventory> action)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.Func<IWarehouseInventory> action

The action to perform when result is not in the cache.

Returns
Type Description
IWarehouseInventory

The item received from cache, or from the internal warehouse inventory service.

ExecuteList(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, Func<IEnumerable<IWarehouseInventory>>)

Tries to get the 'list' result from cache. If the result isn't in the cache, the action will be executed, and the result will be stored in the cache.

Declaration
protected virtual IEnumerable<IWarehouseInventory> ExecuteList(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, Func<IEnumerable<IWarehouseInventory>> action)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.Func<System.Collections.Generic.IEnumerable<IWarehouseInventory>> action

The action to perform when result is not in the cache.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

The items received from cache, or from the internal warehouse inventory service.

ExecuteListTotal(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, Func<IEnumerable<IWarehouseInventory>>)

Tries to get the 'list total' result from cache. If the result isn't in the cache, the action will be executed, and the result will be stored in the cache.

Declaration
protected virtual IEnumerable<IWarehouseInventory> ExecuteListTotal(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, Func<IEnumerable<IWarehouseInventory>> action)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.Func<System.Collections.Generic.IEnumerable<IWarehouseInventory>> action

The action to perform when result is not in the cache.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

The items received from cache, or from the internal warehouse inventory service.

ExecuteWithCache<TResult>(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, Func<TResult>, String)

Tries to get the result from cache. If the result isn't in the cache, the action will be executed, and the result will be stored in the cache.

Declaration
protected virtual TResult ExecuteWithCache<TResult>(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, Func<TResult> action, string cacheConstant)
    where TResult : class
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.Func<TResult> action

The action to perform when result is not in the cache.

System.String cacheConstant

A constant, which can be used to seperate items with same catalogKeys and warehouses.

Returns
Type Description
TResult

The item received from cache, or from the internal warehouse inventory service.

Type Parameters
Name Description
TResult

The type of item to handle.

Get(CatalogKey, IWarehouse)

Gets a single inventory record for a specific catalog entry at a specific warehouse.

Declaration
public virtual IWarehouseInventory Get(CatalogKey catalogKey, IWarehouse warehouse)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to get inventory for.

IWarehouse warehouse

The warehouse to get inventory for.

Returns
Type Description
IWarehouseInventory

All warehouse inventory records for the combination of catalog entry and warehouse.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

GetCacheKey(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>, String)

Gets a cache key which is the combination of catalogKeys, warehouses and cacheConstant.

Declaration
protected virtual string GetCacheKey(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses, string cacheConstant)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog keys.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses.

System.String cacheConstant

A constant, which can be used to seperate items with same catalogKeys and warehouses.

Returns
Type Description
System.String

GetTotal(CatalogKey)

Gets a single inventory record for a specific catalog entry that rolls up all relevant warehouse records.

Declaration
public virtual IWarehouseInventory GetTotal(CatalogKey catalogKey)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to get inventory totals for.

Returns
Type Description
IWarehouseInventory

A single inventory record that contains the overall inventory for the catalog entry.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

GetTotal(CatalogKey, IEnumerable<IWarehouse>)

Gets a single inventory record for a catalog entry that rolls up its inventories across all of the specified warehouse records.

Declaration
public virtual IWarehouseInventory GetTotal(CatalogKey catalogKey, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to get inventory totals for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to get inventory for.

Returns
Type Description
IWarehouseInventory

A single inventory record that contains the overall inventory for the catalog entry at one or more warehouses.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List()

Gets all inventories belong to current eCF application.

Declaration
public virtual IEnumerable<IWarehouseInventory> List()
Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records belong to current eCF application.

List(CatalogKey)

Gets all inventories for a specific catalog entry, separated by warehouse.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(CatalogKey catalogKey)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All warehouse inventory records for the catalog entry.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List(CatalogKey, IEnumerable<IWarehouse>)

Gets the inventory records for a specific catalog entries at one or more warehouses.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(CatalogKey catalogKey, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
CatalogKey catalogKey

The catalog entry to get inventory for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records for the provided catalog entry at any of the provided warehouses.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List(IWarehouse)

Gets all inventories for a specific warehouse, separated by catalog entry.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(IWarehouse warehouse)
Parameters
Type Name Description
IWarehouse warehouse

The warehouse to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records for the warehouse.

List(IEnumerable<CatalogKey>)

Gets all inventories for one or more catalog entries, separated by warehouse.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(IEnumerable<CatalogKey> catalogKeys)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All warehouse inventory records for the provided catalog entries.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List(IEnumerable<CatalogKey>, IWarehouse)

Gets the inventory records for one or more catalog entries at a specific warehouse.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(IEnumerable<CatalogKey> catalogKeys, IWarehouse warehouse)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to get inventory for.

IWarehouse warehouse

The warehouse to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records for the provided catalog entries at the provided warehouse.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>)

Gets the inventory records for one or more catalog entries at one or more warehouses.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to get inventory for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records for one of the provided catalog entries at any of the provided warehouses.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

List(IEnumerable<IWarehouse>)

Gets all inventories for one or more warehouses, separated by catalog entry.

Declaration
public virtual IEnumerable<IWarehouseInventory> List(IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All catalog entry inventory records for the provided warehouses.

ListAll()

Gets all inventories, separated by catalog entry and warehouse.

Declaration
public virtual IEnumerable<IWarehouseInventory> ListAll()
Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

All inventory records.

Remarks

This is intended to be used for internal infrastructure, and should not be used in custom code

ListTotals(IEnumerable<CatalogKey>)

Gets a single inventory record for each provided catalog entry that rolls up all relevant warehouse records for that catalog entry.

Declaration
public virtual IEnumerable<IWarehouseInventory> ListTotals(IEnumerable<CatalogKey> catalogKeys)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to get inventory totals for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

An enumeration of a single inventory record for each provided catalog entry that contains the overall inventory for the catalog entry.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

ListTotals(IEnumerable<CatalogKey>, IEnumerable<IWarehouse>)

Gets a single inventory record for each provided catalog entry that rolls up its inventories across all of the specified warehouse records.

Declaration
public virtual IEnumerable<IWarehouseInventory> ListTotals(IEnumerable<CatalogKey> catalogKeys, IEnumerable<IWarehouse> warehouses)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CatalogKey> catalogKeys

The catalog entries to get inventory totals for.

System.Collections.Generic.IEnumerable<IWarehouse> warehouses

The warehouses to get inventory for.

Returns
Type Description
System.Collections.Generic.IEnumerable<IWarehouseInventory>

An enumeration of a single inventory record for each provided catalog entry that contains the overall inventory for the catalog entry.

Remarks

This method will try to get the items from the the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache.

Save(IWarehouseInventory)

Sets the inventory for a single CatalogEntry at a specific warehouse.

Declaration
public virtual void Save(IWarehouseInventory inventory)
Parameters
Type Name Description
IWarehouseInventory inventory

The inventory to be set.

Remarks

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Save(IEnumerable<IWarehouseInventory>)

Sets the inventories for all passed rows.

Declaration
public virtual void Save(IEnumerable<IWarehouseInventory> inventories)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IWarehouseInventory> inventories

The inventories to be set.

Remarks

It is expected that inventory records that do not match the key combination (i.e. CatalogEntry and warehouse) of any provided record are not changed by this method.

Inventory for a CatalogEntry or a warehouse can be set by passing all relevant inventories for that CatalogEntry or warehouse. Separate methods are not provided for those cases.

This method will use the registrated EPiServer.Framework.Cache.ISynchronizedObjectInstanceCache to clear the warehouse inventory service cache.

Implements