Beispiel #1
0
        public async Task <CustomAttributeTypedArgument> GetAttribute(
            string objectKey,
            string propertyKey,
            string customAttributeKey,
            CancellationToken token)
        {
            var typeDictionary = await CacheFacade
                                 .GetData(
                CacheAttribute,
                objectKey, token).ConfigureAwait(false);

            DictionaryValidation(typeDictionary, nameof(GetDictionaryAttribute));

            var attributeDictionary = await CacheFacade
                                      .GetData(
                typeDictionary,
                propertyKey, token).ConfigureAwait(false);

            DictionaryValidation(attributeDictionary, nameof(GetDictionaryAttribute));

            var result = await CacheFacade
                         .GetData(
                attributeDictionary,
                customAttributeKey, token).ConfigureAwait(false);

            return(result);
        }
Beispiel #2
0
        public async Task <IDictionary <string, Action <object, object> > > GetDictionaryMethodSet(
            string objectKey,
            CancellationToken token)
        {
            var dictionary = await CacheFacade.GetData(CacheSet, objectKey, token).ConfigureAwait(false);

            return(dictionary);
        }
Beispiel #3
0
        public EngineFacade()
        {
            APIEngineCache = new CacheFacade();
            (APIEngineCache as CacheFacade).SinglePostcodeServiceCallback = SinglePostcodeInformation;
            (APIEngineCache as CacheFacade).MultiPostcodeServiceCallback  = MultiPostcodeInformation;

            SupplierResourceName = "postcodes";
        }
Beispiel #4
0
        public async Task <IDictionary <string, Dictionary <string, CustomAttributeTypedArgument> > > GetDictionaryAttribute(
            string objectKey,
            CancellationToken token)
        {
            var result = await CacheFacade.GetData(CacheAttribute, objectKey, token).
                         ConfigureAwait(false);

            return(result);
        }
Beispiel #5
0
        public async Task <IDictionary <string, PropertyInfo> > GetDictionaryProperties(
            string objectKey,
            CancellationToken token)
        {
            var result = await CacheFacade.
                         GetData(CacheProperties, objectKey, token).
                         ConfigureAwait(false);

            return(result);
        }
Beispiel #6
0
        public async Task <PropertyInfo> GetProperty(
            string objectKey,
            string propertyKey,
            CancellationToken token)
        {
            var dictionary = await CacheFacade.
                             GetData(CacheProperties, objectKey, token);

            DictionaryValidation(dictionary, nameof(GetProperty));

            var result = await CacheFacade.
                         GetData(dictionary, propertyKey, token).
                         ConfigureAwait(false);

            return(result);
        }
Beispiel #7
0
        public async Task AddProperty <TValue>(
            CancellationToken token)
        {
            await CacheFacade.RunActionInSemaphore(() =>
            {
                var values = GetValues <TValue>();

                var valid = CacheProperties.ContainsKey(values.typeName);

                if (valid || !values.isCacheable)
                {
                    return;
                }

                CacheProperties.Add(values.typeName, values.properties.ToDictionary(p => p.Name, p => p));
            }, token).ConfigureAwait(false);
        }
Beispiel #8
0
        public async Task <Action <object, object> > GetMethodSet(
            string objectKey,
            string propertyKey,
            CancellationToken token)
        {
            var setMethodDictionary = await CacheFacade.
                                      GetData(CacheSet, objectKey, token).
                                      ConfigureAwait(false);

            DictionaryValidation(setMethodDictionary, nameof(GetMethodSet));

            var result = await CacheFacade.
                         GetData(setMethodDictionary, propertyKey, token).
                         ConfigureAwait(false);

            return(result);
        }
Beispiel #9
0
        public async Task AddGet <TValue>(
            CancellationToken token)
        {
            await CacheFacade.RunActionInSemaphore(() =>
            {
                var values = GetValues <TValue>();

                var valid = CacheGet.ContainsKey(values.typeName);

                if (valid || !values.isCacheable)
                {
                    return;
                }

                var dictionary = values.properties.
                                 ToDictionary(g => g.Name, m => CacheFacade.CreateFunction <TValue>(m));
                CacheGet.Add(values.typeName, dictionary);
            }, token).ConfigureAwait(false);
        }
Beispiel #10
0
        public async Task AddSet <TValue>(
            CancellationToken token)
        {
            await CacheFacade.RunActionInSemaphore(() =>
            {
                var(typeName, properties, isCacheable) = GetValues <TValue>();

                var valid = CacheSet.ContainsKey(typeName);

                if (valid || !isCacheable)
                {
                    return;
                }

                var dictionary = properties.
                                 ToDictionary(s => s.Name, m => CacheFacade.CreateAction <TValue>(m));

                CacheSet.Add(typeName, dictionary);
            }, token).ConfigureAwait(false);
        }
Beispiel #11
0
        public async Task AddAttribute <TValue>(
            CancellationToken token)
        {
            await CacheFacade.RunActionInSemaphore(() =>
            {
                var values = GetValues <TValue>();

                var valid = CacheAttribute.ContainsKey(values.typeName);

                if (valid || !values.isCacheable)
                {
                    return;
                }

                var dictionary = new Dictionary <string, Dictionary <string, CustomAttributeTypedArgument> >(values.properties.Count());

                CacheAttribute.Add(values.typeName, dictionary);

                foreach (var property in values.properties)
                {
                    SetCacheAttributes(property, values.typeName);
                }
            }, token).ConfigureAwait(false);
        }