StorageFactory

Namespace: Proffer.Storage.Internal

Default storage factory to build IStore from configured IStorageProvider.

public class StorageFactory : Proffer.Storage.IStorageFactory

Inheritance ObjectStorageFactory
Implements IStorageFactory

Constructors

StorageFactory(IEnumerable<IStorageProvider>, IOptions<StorageOptions>)

Initializes a new instance of the StorageFactory class.

public StorageFactory(IEnumerable<IStorageProvider> storageProviders, IOptions<StorageOptions> options)

Parameters

storageProviders IEnumerable<IStorageProvider>
The storage providers.

options IOptions<StorageOptions>
The options.

Methods

GetStore(String, IStoreOptions)

Gets a store with specific options.

public IStore GetStore(string storeName, IStoreOptions configuration)

Parameters

storeName String
The name of the store.

configuration IStoreOptions
The store options.

Returns

IStore

        A configured .

Exceptions

BadProviderConfiguration

BadStoreConfiguration

ProviderNotFoundException

StoreNotFoundException

GetStore(String)

Gets a store from configured options.

public IStore GetStore(string storeName)

Parameters

storeName String
The name of the store.

Returns

IStore

        A configured .

Exceptions

BadProviderConfiguration

BadStoreConfiguration

ProviderNotFoundException

StoreNotFoundException

GetScopedStore(String, Object[])

Gets a scoped store from configured options.

public IStore GetScopedStore(string storeName, Object[] args)

Parameters

storeName String
The name of the scoped store.

args Object[]
The arguments to apply to the scoped store name format.

Returns

IStore

        A configured .

Exceptions

BadProviderConfiguration

BadStoreConfiguration

ProviderNotFoundException

StoreNotFoundException

BadScopedStoreConfiguration

TryGetStore(String, IStore&)

Gets a store from configured options.

public bool TryGetStore(string storeName, IStore& store)

Parameters

storeName String
The name of the store.

store IStore&
When this method returns, contains the store associated with the specified name, if it is found in the ; otherwise, null. This parameter is passed uninitialized.

Returns

Boolean
true if the store was configured and built from its provider; otherwise, false.

Exceptions

BadProviderConfiguration

BadStoreConfiguration

ProviderNotFoundException

StoreNotFoundException

TryGetStore(String, IStore&, String)

Gets a store from configured options.

public bool TryGetStore(string storeName, IStore& store, string providerName)

Parameters

storeName String
The name of the store.

store IStore&
When this method returns, contains the store associated with the specified name, if it is found in the ; otherwise, null. This parameter is passed uninitialized.

providerName String
The explicit provider name from which the store should be built.

Returns

Boolean
true if the store was configured and built from its provider; otherwise, false.

Exceptions

BadProviderConfiguration

BadStoreConfiguration

ProviderNotFoundException

StoreNotFoundException