Exemplo n.º 1
0
        private static Type GetProviderType(IHorizontalCacheConfiguration hconfig)
        {
            if (hconfig == null)
            {
                return(null);
            }

            if (!hconfig.IsEnabled)
            {
                return(null);
            }

            return(hconfig.ProviderType);
        }
Exemplo n.º 2
0
 internal InCodeCacheConfiguration(IHorizontalCacheConfiguration cacheConfiguration)
 {
     _cacheConfiguration = cacheConfiguration;
 }
Exemplo n.º 3
0
        private static object CreateCacheProviderFromConfig(Type entityType, string dataStoreSetId, IHorizontalCacheConfiguration hconfig, object dao, IEnumerable <PropertyInfo> cachedProperties)
        {
            var cacheProviderType = GetProviderType(hconfig);

            if (cacheProviderType == null)
            {
                return(null);
            }

            var dataSourceEnumerator = typeof(IDataSourceEnumerator <>).MakeGenericType(entityType);

            if (!dataSourceEnumerator.IsAssignableFrom(dao.GetType()))
            {
                return(null);
            }

            var persistentCacheProviderType = cacheProviderType.MakeGenericType(entityType);

            return(Activator.CreateInstance(persistentCacheProviderType, dataStoreSetId, hconfig.GetAllParameters(), dao, cachedProperties));
        }