protected override void InitializeCore(ConfigSettingData config, Guid fileId, string extendsionName) { string log = string.Empty; string filePath = GetFilePath(); log = string.Format("LogicFileID='{0}' | FilePath='{1}'", fileId, filePath); LogHelper.Log.Debug(log); }
public virtual void Initialize(ConfigSettingData config, Guid fileId, string extensionName) { _configSetting = config; _fileID = fileId; if (!string.IsNullOrEmpty(extensionName) && !extensionName.StartsWith(".")) { extensionName = "." + extensionName; } _extensionName = extensionName; this.InitializeCore(config, fileId, extensionName); }
public static ConfigSettingData GetConfigSetting(IFileStorageProviderDataProvider dataProvider, Guid physicalFileID) { ConfigSettingData result = _settingsCacheByID[physicalFileID]; if (result != null) { return(result.Clone()); } lock (_settingsCacheByID) { result = _settingsCacheByID[physicalFileID]; } if (result != null) { return(result.Clone()); } if (dataProvider == null) { dataProvider = DataProvider; } StoreModeData storeData = dataProvider.GetStoreModeByFileID(physicalFileID); if (storeData != null) { if (!_settingsCache.TryGetValue(storeData.StoreParams, out result)) { lock (_settingsCache) { if (!_settingsCache.TryGetValue(storeData.StoreParams, out result)) { result = ObjectFactory.XmlDeserializeObject(typeof(ConfigSettingData), storeData.StoreParams) as ConfigSettingData; _settingsCache[storeData.StoreParams] = result; } } } if (result != null) { lock (_settingsCacheByID) { _settingsCacheByID.Add(physicalFileID, result); } return(result.Clone()); } } else { result = CurrentConfigSetting.Clone(); } return(result); }
public void Add(Guid id, ConfigSettingData config) { if (config == null || _dict.ContainsKey(id)) { return; } if (_dict.Count >= MaxCount) { Guid removeID = _list[0]; _dict.Remove(removeID); _list.RemoveAt(0); } _list.Add(id); _dict[id] = config; }
public static void Initialize(IFileStorageProviderDataProvider dataProvider) { if (_currentStoreModeID == Guid.Empty || _lastDate != DateTime.UtcNow.Date) { lock (_inializeLock) { if (_currentStoreModeID == Guid.Empty || _lastDate != DateTime.UtcNow.Date) { _lastDate = DateTime.UtcNow.Date; Refresh(); ConfigSettingData configData = CurrentConfigSetting; if (configData != null) { if (dataProvider == null) { dataProvider = DataProvider; } StoreModeData oldData = dataProvider.GetStoreModeByID(Guid.Empty); StoreModeData data = new StoreModeData(); data.StoreParams = ObjectFactory.XmlSerializerObject(configData); if (oldData != null && oldData.StoreParams == data.StoreParams) { _currentStoreModeID = oldData.ID; return; } Guid id = CombineGuid.NewComboGuid(); data.ID = id; dataProvider.SaveStoreMode(data); if (!_settingsCache.ContainsKey(data.StoreParams)) { lock (_settingsCache) { if (!_settingsCache.ContainsKey(data.StoreParams)) { _settingsCache[data.StoreParams] = configData; } } } _currentStoreModeID = id; } } } } }
private static void Refresh() { _currentConfigSettings = null; }
public static IFileStorageProvider CreateFileStorageProvider(IFileStorageProviderDataProvider dataProvider, ConfigSettingData configData, Guid physicalFileID, string extendsionName) { IFileStorageProvider provider = null; if (configData == null) { configData = FileStorageManager.GetConfigSetting(dataProvider, physicalFileID); } if (configData != null && configData.FileStorage != null) { provider = ObjectFactory.CreateObject(configData.FileStorage.Provider) as IFileStorageProvider; if (provider != null) { provider.Initialize(configData, physicalFileID, extendsionName); } } return(provider); }
protected abstract void InitializeCore(ConfigSettingData config, Guid fileId, string extensionName);