Beispiel #1
0
        public IDataStore DataStore <T>(BaseStorageSettings <T> baseStorageSettings) where T : class, ISettings, new()
        {
            if (dataStore != null)
            {
                return(dataStore);
            }

            if (DataStoreConsumer(baseStorageSettings).HandlerType == null)
            {
                return(null);
            }

            return(dataStore = ((IDataStore)
                                Activator.CreateInstance(DataStoreConsumer(baseStorageSettings).HandlerType, TenantManager, PathUtils, HttpContextAccessor, Options))
                               .Configure(TenantManager.GetCurrentTenant().TenantId.ToString(), null, null, DataStoreConsumer(baseStorageSettings)));
        }
Beispiel #2
0
        public DataStoreConsumer DataStoreConsumer <T>(BaseStorageSettings <T> baseStorageSettings) where T : class, ISettings, new()
        {
            if (string.IsNullOrEmpty(baseStorageSettings.Module) || baseStorageSettings.Props == null)
            {
                return(dataStoreConsumer = new DataStoreConsumer());
            }

            var consumer = ConsumerFactory.GetByName <DataStoreConsumer>(baseStorageSettings.Module);

            if (!consumer.IsSet)
            {
                return(dataStoreConsumer = new DataStoreConsumer());
            }

            dataStoreConsumer = (DataStoreConsumer)consumer.Clone();

            foreach (var prop in baseStorageSettings.Props)
            {
                dataStoreConsumer[prop.Key] = prop.Value;
            }

            return(dataStoreConsumer);
        }
Beispiel #3
0
 public void Clear <T>(BaseStorageSettings <T> baseStorageSettings) where T : class, ISettings, new()
 {
     baseStorageSettings.Module = null;
     baseStorageSettings.Props  = null;
     Save(baseStorageSettings);
 }
Beispiel #4
0
 public bool Save <T>(BaseStorageSettings <T> baseStorageSettings) where T : class, ISettings, new()
 {
     ClearDataStoreCache();
     dataStoreConsumer = null;
     return(SettingsManager.Save(baseStorageSettings));
 }