public FundingStreamPermissionService(
            IUserRepository userRepository,
            ISpecificationsApiClient specificationsApiClient,
            IVersionRepository <FundingStreamPermissionVersion> fundingStreamPermissionVersionRepository,
            ICacheProvider cacheProvider,
            IMapper mapper,
            ILogger logger,
            IUsersResiliencePolicies policies)
        {
            Guard.ArgumentNotNull(userRepository, nameof(userRepository));
            Guard.ArgumentNotNull(specificationsApiClient, nameof(specificationsApiClient));
            Guard.ArgumentNotNull(fundingStreamPermissionVersionRepository, nameof(fundingStreamPermissionVersionRepository));
            Guard.ArgumentNotNull(cacheProvider, nameof(cacheProvider));
            Guard.ArgumentNotNull(mapper, nameof(mapper));
            Guard.ArgumentNotNull(logger, nameof(logger));
            Guard.ArgumentNotNull(policies?.UserRepositoryPolicy, nameof(policies.UserRepositoryPolicy));
            Guard.ArgumentNotNull(policies?.SpecificationApiClient, nameof(policies.SpecificationApiClient));
            Guard.ArgumentNotNull(policies?.FundingStreamPermissionVersionRepositoryPolicy, nameof(policies.FundingStreamPermissionVersionRepositoryPolicy));
            Guard.ArgumentNotNull(policies?.CacheProviderPolicy, nameof(policies.CacheProviderPolicy));

            _userRepository          = userRepository;
            _specificationsApiClient = specificationsApiClient;
            _fundingStreamPermissionVersionRepository = fundingStreamPermissionVersionRepository;
            _cacheProvider = cacheProvider;
            _mapper        = mapper;
            _logger        = logger;

            _userRepositoryPolicy          = policies.UserRepositoryPolicy;
            _specificationsApiClientPolicy = policies.SpecificationApiClient;
            _fundingStreamPermissionVersionRepositoryPolicy = policies.FundingStreamPermissionVersionRepositoryPolicy;
            _cacheProviderPolicy = policies.CacheProviderPolicy;
        }
Пример #2
0
 public FundingStreamPermissionService CreateService(
     IUserRepository userRepository = null,
     ISpecificationRepository specificationRepository = null,
     IVersionRepository <FundingStreamPermissionVersion> fundingStreamPermissionVersionRepository = null,
     ICacheProvider cacheProvider = null,
     IMapper mapper = null,
     ILogger logger = null,
     IUsersResiliencePolicies policies = null)
 {
     return(new FundingStreamPermissionService(
                userRepository ?? CreateUserRepository(),
                specificationRepository ?? CreateSpecificationRepository(),
                fundingStreamPermissionVersionRepository ?? CreateFundingStreamPermissionRepository(),
                cacheProvider ?? CreateCacheProvider(),
                mapper ?? CreateMappingConfiguration(),
                logger ?? CreateLogger(),
                policies ?? CreatePoliciesNoOp()
                ));
 }