示例#1
0
        private static IDataStore GetDataStore(string tenant, StorageConfigurationSection section, string module,
                                               HttpContext context, IQuotaController controller)
        {
            ModuleConfigurationElement moduleElement = section.Modules.GetModuleElement(module);

            if (moduleElement == null)
            {
                throw new ArgumentException("no such module");
            }
            HandlerConfigurationElement handler = section.Handlers.GetHandler(moduleElement.Type);

            return
                (((IDataStore)Activator.CreateInstance(handler.Type, tenant, moduleElement, context)).Configure(
                     handler.GetProperties()).SetQuotaController(moduleElement.Count?controller:null /*don't count quota if specified on module*/));
        }
示例#2
0
        public DiscDataStore(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
        {
            _tenant = tenant;
            //Fill map path
            _modulename = moduleConfig.Name;
            _dataList   = new DataList(moduleConfig);
            foreach (DomainConfigurationElement domain in moduleConfig.Domains)
            {
                _mappedPaths.Add(domain.Name, new MappedPath(tenant, moduleConfig.AppendTenant, domain.Path, handlerConfig.GetProperties()));
            }
            //Add default
            _mappedPaths.Add(string.Empty, new MappedPath(tenant, moduleConfig.AppendTenant, PathUtils.Normalize(moduleConfig.Path), handlerConfig.GetProperties()));

            //Make expires
            _domainsExpires =
                moduleConfig.Domains.Cast <DomainConfigurationElement>().Where(x => x.Expires != TimeSpan.Zero).
                ToDictionary(x => x.Name,
                             y => y.Expires);
            _domainsExpires.Add(string.Empty, moduleConfig.Expires);
        }
示例#3
0
 public DiscDataStore(string tenant, HandlerConfigurationElement handlerConfig, ModuleConfigurationElement moduleConfig)
 {
     //Fill map path
     _modulename = moduleConfig.Name;
     _dataList   = new DataList(moduleConfig);
     foreach (DomainConfigurationElement domain in moduleConfig.Domains)
     {
         _mappedPaths.Add(domain.Name, new MappedPath(tenant, moduleConfig.AppendTenant, domain.Path, domain.VirtualPath, handlerConfig.GetProperties()));
     }
     //Add default
     _mappedPaths.Add(string.Empty, new MappedPath(tenant, moduleConfig.AppendTenant, PathUtils.Normalize(moduleConfig.Path), moduleConfig.VirtualPath, handlerConfig.GetProperties()));
 }