Class CachedRepositoryRegistry
The CachedRepositoryRegistry will setup StructureMap to map all interfaces inheriting a specific interface (baseInterface) with their concrete implementations and look for a specific suffix and select that one before the other implementations
Inheritance
Namespace: ImageVault.Core.DataAccess.Repositories
Assembly: ImageVault.Core.dll
Syntax
[CLSCompliant(false)]
public class CachedRepositoryRegistry : Registry
Examples
Consider the baseinterface IRepository
Create a few other interfaces IMediaRepository and IVaultRepository both inheriting IRepository
Create implementations for the interfaces VaultRepository and MediaRepository
When calling the CachedRepository constructor with
var reg = new CachedRepositoryRegistry(typeof(VaultRepository).Assembly, typeof(IRepository))
this will map structuremap to return a singleton of IVaultRepository to be the VaultRepository instance.
If introducing the VaultCachedRepository implementation in the same assembly as VaultRepository, this will be returned instead
(by the name convention used in this registry)
Constructors
CachedRepositoryRegistry(Assembly, Type, Type[])
Initializes a new instance of the CachedRepositoryRegistry class.
Declaration
public CachedRepositoryRegistry(Assembly repositoryAssembly, Type baseInterfaceType, params Type[] interfaceTypesToIgnore)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly | repositoryAssembly | The System.Reflection.Assembly to search for implementations and interfaces |
System.Type | baseInterfaceType | The System.Type of interface that all matching interfaces must inherit to match |
System.Type[] | interfaceTypesToIgnore | List of interface types to ignore |