Update: This feature as been decommissioned in v3.3.5, leaving document here for support for those that are on < v3.3.5.
Example (Unit Test) on How to Add Custom Repositories
This allows you to access all Repositories in your application the same way, so that it's consistent for all Repositories not just for database (EF) ones.
Full source code
Example (Unit Test) on How to Add Custom Repositories
This allows you to access all Repositories in your application the same way, so that it's consistent for all Repositories not just for database (EF) ones.
Full source code
[TestMethod] publicvoid GetCustomRepositoryFromOtherRepository() { // Setup custom repositories e.g. IAzureBlobRepositoryvar factories = new Dictionary<Type, Func<dynamic>> { { typeof (IAzureBlobRepository<MyBlob>), () => new AzureBlobRepository<MyBlob>() } }; IRepositoryProvider repositoryProvider = new RepositoryProvider(new RepositoryFactories(factories)); using (IDataContextAsync context = new NorthwindFakeContext()) using (IUnitOfWorkAsync uow = new UnitOfWork(context, repositoryProvider)) { IRepositoryAsync<Product> productRepository = new Repository<Product>(context, uow); // Retrieving custom repository from UnitOfWork instancevar blobRepository1 = uow.GetCustomRepository<IAzureBlobRepository<MyBlob>>(); // Retrieving custom repository from another repositoryvar blobRepository2 = productRepository.GetCustomRepository<IAzureBlobRepository<MyBlob>>(); Assert.AreEqual(blobRepository1.SayHello(), "Hello World!"); Assert.AreEqual(blobRepository2.SayHello(), "Hello World!"); } }