private static IDataStore GetStoreAndCache(string tenant, string module, StorageConfigurationSection section, HttpContext context, IQuotaController controller) { IDataStore store = GetDataStore(tenant, section, module, context, controller); if (store != null) { DataStoreCache.Put(store, tenant, module); } return store; }
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*/); }