Beispiel #1
0
        public BlogEngine(IBlogAccessor dbAccessor, ICacheAccessor cacheAccessor)
        {
            _dbAccessor = dbAccessor
                          ?? throw new ArgumentNullException(nameof(dbAccessor));

            _cacheAccessor = cacheAccessor
                             ?? throw new ArgumentNullException(nameof(cacheAccessor));
        }
 public void ClearUp()
 {
     if (_cacheThatsConnected != null)
     {
         _cacheThatsConnected.Dispose();
         _cacheThatsConnected = null;
     }
 }
        public LocalizationEngine(ILocalizationAccessor localizationAccessor, ICacheAccessor cacheAccessor)
        {
            _localizationAccessor = localizationAccessor
                                    ?? throw new ArgumentNullException(nameof(localizationAccessor));

            _cacheAccessor = cacheAccessor
                             ?? throw new ArgumentNullException(nameof(cacheAccessor));
        }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UrlDataStore"/> class.
 /// CacheMode specifies if we need in-memory cache or distributed redis cache
 /// </summary>
 /// <param name="dbConnString">The db conn string.</param>
 /// <param name="cacheConnString">The cache conn string.</param>
 /// <param name="cacheMode">The cache mode.</param>
 public UrlDataStore(string dbConnString, string cacheConnString, string cacheMode)
 {
     azureStore = new AzureKeyValueStorageAccessor(dbConnString, TableName);
     if (cacheMode == "local")
         cacheStore = new InMemoryCacheAccessor();
     else
         cacheStore = new RedisCacheAccessor(cacheConnString);    
 }
        /// <summary>
        /// Overrides the CacheAccessor.  (By default, this is MemoryStream-based).
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>

        public RewindableBuilder SetCacheAccessor(ICacheAccessor value)
        {
            if (value == null)
                throw new ArgumentNullException("value");

            _cacheAccessor = new Lazy<ICacheAccessor>(() => value);

            return this;
        }
Beispiel #6
0
 internal /* internal for test, otherwise private */ MsalCacheStorage(
     StorageCreationProperties creationProperties,
     ICacheAccessor cacheAccessor,
     TraceSourceLogger logger)
 {
     StorageCreationProperties = creationProperties;
     _logger       = logger;
     CacheAccessor = cacheAccessor;
     _logger.LogInformation($"Initialized '{nameof(MsalCacheStorage)}'");
 }
 public SitemapController(IEstablishmentReadService establishmentReadService,
                          IGroupReadService groupReadService,
                          ICacheAccessor cacheAccessor,
                          ICachedLookupService lookupService)
 {
     _establishmentReadService = establishmentReadService;
     _groupReadService         = groupReadService;
     _cacheAccessor            = cacheAccessor;
     _lookupService            = lookupService;
 }
Beispiel #8
0
        public void Constructor_Should_Throw_ArgumentNullException_When_CacheAccessor_Is_Null()
        {
            // Arrange
            ICacheAccessor caceAccessor = null;
            Action         ctor         = () => new ProductRepository(_mockContextFactory.Object, caceAccessor);

            // Act + Assert
            ctor.Should()
            .Throw <ArgumentNullException>();
        }
        public RewindableStream(Stream sourceStream, ICacheAccessor cacheAccessor,
            long? autoTruncateAtBytes, long? autoTruncationTailLength)
        {
            _sourceStream = sourceStream;

            _cacheAccessor = cacheAccessor;

            _autoTruncateAtBytes = autoTruncateAtBytes;

            _autoTruncationTailLength = autoTruncationTailLength;
        }
        public DpApiEncryptedFileAccessor(string cacheFilePath, TraceSourceLogger logger)
        {
            if (string.IsNullOrEmpty(cacheFilePath))
            {
                throw new ArgumentNullException(nameof(cacheFilePath));
            }

            _cacheFilePath           = cacheFilePath;
            _logger                  = logger ?? throw new ArgumentNullException(nameof(logger));
            _unencryptedFileAccessor = new FileAccessor(_cacheFilePath, _logger);
        }
            public void Should_throw_argument_null_exception_when_cache_accessor_is_null()
            {
                // arrange

                ICacheAccessor cacheAccessor = null;

                // act & assert

                Assert.Throws <ArgumentNullException>(nameof(cacheAccessor),
                                                      () => new PidPluginClient(this.HttpClient, cacheAccessor, this.CacheOptions));
            }
        public PidPluginClient(HttpClient httpClient, ICacheAccessor cacheAccessor, IOptions <CacheOptions> options)
        {
            this.httpClient = httpClient ??
                              throw new ArgumentNullException(nameof(httpClient));

            this.cacheAccessor = cacheAccessor ??
                                 throw new ArgumentNullException(nameof(cacheAccessor));

            this.options = options ??
                           throw new ArgumentNullException(nameof(options));
        }
Beispiel #13
0
        public DirectoryEngine(IDirectoryAccessor directoryAccessor, ICacheAccessor cacheAccessor, IExportAccessor exportAccessor)
        {
            _directoryAccessor = directoryAccessor
                                 ?? throw new ArgumentNullException(nameof(directoryAccessor));

            _cacheAccessor = cacheAccessor
                             ?? throw new ArgumentNullException(nameof(cacheAccessor));

            _exportAccessor = exportAccessor
                              ?? throw new ArgumentNullException(nameof(exportAccessor));
        }
        public ExportProcessingEngine(IExportAccessor exportAccessor,
                                      IDirectoryAccessor directoryAccessor, IEmailAccessor emailAccessor, ICacheAccessor cache)
        {
            _exportAccessor = exportAccessor
                              ?? throw new ArgumentNullException(nameof(exportAccessor));

            _directoryAccessor = directoryAccessor
                                 ?? throw new ArgumentNullException(nameof(directoryAccessor));

            _emailAccessor = emailAccessor
                             ?? throw new ArgumentNullException(nameof(emailAccessor));

            _cache = cache
                     ?? throw new ArgumentNullException(nameof(cache));
        }
        private static void ReadOrReadWriteClear(ICacheAccessor accessor)
        {
            Console.WriteLine(accessor.ToString());
            var bytes = accessor.Read();

            if (bytes == null || bytes.Length == 0)
            {
                Console.WriteLine("No data found, writing some");
                accessor.Write(s_payload);
                var bytes2 = accessor.Read();
                accessor.Clear();
                Console.WriteLine("All good");
            }
            else
            {
                string s = Encoding.UTF8.GetString(bytes);
                Console.WriteLine($"Found some data ... {s.Substring(0,20)}...");

                Console.WriteLine("Stopping");
            }
        }
        private static void TestAccessors(ICacheAccessor macKeychainAccessor1)
        {
            var persistenceValidator = macKeychainAccessor1.CreateForPersistenceValidation();

            try
            {
                Console.WriteLine("Trying the location used for validation first .. ");
                ReadOrReadWriteClear(persistenceValidator);
            }
            catch (Exception e)
            {
                PrintException(e);
            }

            try
            {
                Console.WriteLine("Trying the real location");
                ReadOrReadWriteClear(macKeychainAccessor1);
            }
            catch (Exception e)
            {
                PrintException(e);
            }
        }
Beispiel #17
0
 public CachedLookupService(ILookupService lookupService, ICacheAccessor cacheAccessor)
 {
     _lookupService = lookupService;
     _cacheAccessor = cacheAccessor;
     _mappingAsync  = new Dictionary <string, Func <int, Task <string> > >
     {
         { "LocalAuthorityId", async id => (await LocalAuthorityGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "RSCRegionId", async id => (await RscRegionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "TypeId", async id => (await EstablishmentTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "GroupTypeId", async id => (await GroupTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "Group.StatusId", async id => (await GroupStatusesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "StatusId", async id => (await EstablishmentStatusesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ReasonEstablishmentOpenedId", async id => (await ReasonEstablishmentOpenedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ReasonEstablishmentClosedId", async id => (await ReasonEstablishmentClosedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "IndependentSchoolTypeId", async id => (await IndependentSchoolTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "EducationPhaseId", async id => (await EducationPhasesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ProvisionBoardingId", async id => (await ProvisionBoardingGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ProvisionNurseryId", async id => (await ProvisionNurseriesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "IEBTModel.BoardingEstablishmentId", async id => (await BoardingEstablishmentGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "IEBTModel.AccommodationChangedId", async id => (await AccommodationChangedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ProvisionOfficialSixthFormId", async id => (await ProvisionOfficialSixthFormsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "GenderId", async id => (await GendersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ReligiousCharacterId", async id => (await ReligiousCharactersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ReligiousEthosId", async id => (await ReligiousEthosGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "DioceseId", async id => (await DiocesesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "AdmissionsPolicyId", async id => (await AdmissionsPoliciesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ProvisionSpecialClassesId", async id => (await ProvisionSpecialClassesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "HeadTitleId", async id => (await TitlesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "EstablishmentTypeGroupId", async id => (await EstablishmentTypeGroupsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "InspectorateId", async id => (await InspectoratesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "Section41ApprovedId", async id => (await Section41ApprovedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "SEN1Id", async id => (await SpecialEducationNeedsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "TeenageMothersProvisionId", async id => (await TeenageMothersProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ChildcareFacilitiesId", async id => (await ChildcareFacilitiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "PRUSENId", async id => (await PRUSENsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "PRUEBDId", async id => (await PRUEBDsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "PruFulltimeProvisionId", async id => (await PruFulltimeProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "PruEducatedByOthersId", async id => (await PruEducatedByOthersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "TypeOfResourcedProvisionId", async id => (await TypeOfResourcedProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "GovernmentOfficeRegionId", async id => (await GovernmentOfficeRegionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "AdministrativeDistrictId", async id => (await AdministrativeDistrictsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "AdministrativeWardId", async id => (await AdministrativeWardsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "ParliamentaryConstituencyId", async id => (await ParliamentaryConstituenciesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "UrbanRuralId", async id => (await UrbanRuralGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "GSSLAId", async id => (await GSSLAGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CASWardId", async id => (await CASWardsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "MSOAId", async id => (await MSOAsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "LSOAId", async id => (await LSOAsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "FurtherEducationTypeId", async id => (await FurtherEducationTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "InspectorateNameId", async id => (await InspectorateNamesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "BSOInspectorateId", async id => (await InspectorateNamesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCOperationalHoursId", async id => (await CCOperationalHoursGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCGovernanceId", async id => (await CCGovernanceGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCPhaseTypeId", async id => (await CCPhaseTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCDisadvantagedAreaId", async id => (await CCDisadvantagedAreasGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCDirectProvisionOfEarlyYearsId", async id => (await DirectProvisionOfEarlyYearsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCDeliveryModelId", async id => (await CCDeliveryModelsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CCGroupLeadId", async id => (await CCGroupLeadsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "LinkTypeId", async id => (await EstablishmentLinkTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CountryId", async id => (await NationalitiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "CountyId", async id => (await CountiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
         { "OfstedRatingId", async id => (await OfstedRatingsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
     };
 }
 public void Setup()
 {
     // Create cache that is actually connected
     _cacheThatsConnected = CacheAccessor.Create();
     _cacheThatsConnected.InitialiseIfNecessaryAsync().Wait();
 }
 public HomeController(ILookupService lookup, IBlobService blobService, ICacheAccessor cacheAccessor)
 {
     _lookup        = lookup;
     _blobService   = blobService;
     _cacheAccessor = cacheAccessor;
 }
Beispiel #20
0
 public ProductRepository(IContextFactory contextFactory, ICacheAccessor cacheAccessor)
 {
     _contextFactory = contextFactory ?? throw new ArgumentNullException(nameof(contextFactory));
     _cacheAccessor  = cacheAccessor ?? throw new ArgumentNullException(nameof(cacheAccessor));
 }
Beispiel #21
0
 public Producer(ICacheAccessor cacheAccessor, IConfiguration configuration)
 {
     this.cacheAccessor = cacheAccessor;
     this.configuration = configuration;
 }
 public ApiMiddlewareService(ICacheAccessor cacheAccessor)
 {
     this.cacheAccessor = cacheAccessor;
 }
 public ObjectCache(ICacheAccessor cacheAccessor,
                    ITriggerFileManager TriggerFileManager)
 {
     _cache = cacheAccessor.CacheInstance;
     _TriggerFileManager = TriggerFileManager;
 }
        public CachedLookupService(ILookupService lookupService, ICacheAccessor cacheAccessor)
        {
            _lookupService = lookupService;
            _cacheAccessor = cacheAccessor;
            _mappingAsync  = new Dictionary <string, Func <int, Task <string> > >
            {
                { "LocalAuthorityId", async id => (await LocalAuthorityGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "RSCRegionId", async id => (await RscRegionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "TypeId", async id => (await EstablishmentTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "GroupTypeId", async id => (await GroupTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "Group.StatusId", async id => (await GroupStatusesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "StatusId", async id => (await EstablishmentStatusesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ReasonEstablishmentOpenedId", async id => (await ReasonEstablishmentOpenedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ReasonEstablishmentClosedId", async id => (await ReasonEstablishmentClosedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "IndependentSchoolTypeId", async id => (await IndependentSchoolTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "EducationPhaseId", async id => (await EducationPhasesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ProvisionBoardingId", async id => (await ProvisionBoardingGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ProvisionNurseryId", async id => (await ProvisionNurseriesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "IEBTModel.BoardingEstablishmentId", async id => (await BoardingEstablishmentGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "IEBTModel.AccommodationChangedId", async id => (await AccommodationChangedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "QualityAssuranceBodyNameId", async id => (await QualityAssuranceBodyNameGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "EstablishmentAccreditedId", async id => (await EstablishmentAccreditedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ProvisionOfficialSixthFormId", async id => (await ProvisionOfficialSixthFormsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "GenderId", async id => (await GendersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ReligiousCharacterId", async id => (await ReligiousCharactersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ReligiousEthosId", async id => (await ReligiousEthosGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "DioceseId", async id => (await DiocesesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "AdmissionsPolicyId", async id => (await AdmissionsPoliciesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ProvisionSpecialClassesId", async id => (await ProvisionSpecialClassesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "HeadTitleId", async id => (await TitlesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "EstablishmentTypeGroupId", async id => (await EstablishmentTypeGroupsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "InspectorateId", async id => (await InspectoratesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "Section41ApprovedId", async id => (await Section41ApprovedGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "SEN1Id", async id => (await SpecialEducationNeedsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "TeenageMothersProvisionId", async id => (await TeenageMothersProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ChildcareFacilitiesId", async id => (await ChildcareFacilitiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "PRUSENId", async id => (await PRUSENsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "PRUEBDId", async id => (await PRUEBDsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "PruFulltimeProvisionId", async id => (await PruFulltimeProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "PruEducatedByOthersId", async id => (await PruEducatedByOthersGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "TypeOfResourcedProvisionId", async id => (await TypeOfResourcedProvisionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "GovernmentOfficeRegionId", async id => (await GovernmentOfficeRegionsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "AdministrativeDistrictId", async id => (await AdministrativeDistrictsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "AdministrativeWardId", async id => (await AdministrativeWardsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "ParliamentaryConstituencyId", async id => (await ParliamentaryConstituenciesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "UrbanRuralId", async id => (await UrbanRuralGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "GSSLAId", async id => (await GSSLAGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CASWardId", async id => (await CASWardsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "MSOAId", async id => (await MSOAsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "LSOAId", async id => (await LSOAsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "FurtherEducationTypeId", async id => (await FurtherEducationTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "InspectorateNameId", async id => (await InspectorateNamesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "BSOInspectorateId", async id => (await InspectorateNamesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCOperationalHoursId", async id => (await CCOperationalHoursGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCGovernanceId", async id => (await CCGovernanceGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCPhaseTypeId", async id => (await CCPhaseTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCDisadvantagedAreaId", async id => (await CCDisadvantagedAreasGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCDirectProvisionOfEarlyYearsId", async id => (await DirectProvisionOfEarlyYearsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCDeliveryModelId", async id => (await CCDeliveryModelsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CCGroupLeadId", async id => (await CCGroupLeadsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "LinkTypeId", async id => (await EstablishmentLinkTypesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CountryId", async id => (await NationalitiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "CountyId", async id => (await CountiesGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "OfstedRatingId", async id => (await OfstedRatingsGetAllAsync()).FirstOrDefault(x => x.Id == id)?.Name },
                { "IEBTModel.ProprietorTypeId", async id => (await Task.Run(() =>
                    {
                        // a little bit overkill, but making use of the existing pattern to display enum choice
                        var pt = (eProprietorType)id;
                        var type = pt.GetType();
                        var member = type.GetMember(pt.ToString());
                        var displayName = pt.ToString();

                        var attributes = member.Select(e => e.GetCustomAttributes(typeof(DisplayAttribute), false)).FirstOrDefault();
                        if (attributes != null && attributes.Length > 0)
                        {
                            displayName = ((DisplayAttribute)attributes[0]).Name;
                        }

                        return(displayName);
                    })) }
            };
        }
Beispiel #25
0
 public BatchCachingService(ICacheAccessor cache, IBatchSettings batchSettings)
 {
     this.cache         = cache;
     this.batchSettings = batchSettings;
 }