Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface IRepositoryFactory
- {
- IProjectRepository CreateProjectRepository();
- IConfigurationRepository CreateConfigurationRepository();
- ICostCategoryRepository CreateCostCategoryRepository();
- ICostRepository CreateCostRepository();
- }
- public class SampleRepositoryFactory : IRepositoryFactory
- {
- private IProjectRepository _cachedProjectRepository;
- private ICostRepository _cachedCostRepository;
- ...
- public IProjectRepository CreateProjectRepository()
- {
- if(_cachedProjectRepository == null)
- _cachedProjectRepository = new SampleProjectRepository();
- return _cachedProjectRepository;
- }
- public IConfigurationRepository CreateConfigurationRepository()
- {
- ....
- }
- public ICostCategoryRepository CreateCostCategoryRepository()
- {
- ....
- }
- public ICostRepository CreateCostRepository()
- {
- ...
- }
- }
Add Comment
Please, Sign In to add comment