bool TypeExists(DataStoreManagerSimpleDataLayer dataLayer, InsertStatement stm1) { if (dataLayer.IsMainLayer) return false; var session = new Session(dataLayer) { IdentityMapBehavior = IdentityMapBehavior.Strong }; var value = stm1.Parameters.ToList()[0].Value as string; var xpObjectType = session.FindObject<XPObjectType>(type => type.TypeName == value); return xpObjectType != null; }
public DataStoreManagerSimpleDataLayer GetDataLayer(string key, IDataStore defaultStore) { if (!_simpleDataLayers.ContainsKey(key)) { var keyValuePair = _reflectionDictionaries.First(info => info.Key.Key == key); var connectionProvider = keyValuePair.Key.Key == DefaultDictionaryKey?defaultStore:GetConnectionProvider(keyValuePair.Key.Key); var simpleDataLayer = new DataStoreManagerSimpleDataLayer(keyValuePair.Value, connectionProvider, keyValuePair.Key.Key == DefaultDictionaryKey, keyValuePair.Key.IsLegacy); _simpleDataLayers.Add(keyValuePair.Key.Key, simpleDataLayer); } return(_simpleDataLayers[key]); }
ReflectionDictionary GetDictionary(KeyInfo keyInfo) { if (!_reflectionDictionaries.ContainsKey(keyInfo.Key)) { var reflectionDictionary = new ReflectionDictionary(); _reflectionDictionaries.Add(keyInfo.Key, reflectionDictionary); var simpleDataLayer = new DataStoreManagerSimpleDataLayer(reflectionDictionary, GetConnectionProvider(keyInfo.Key), keyInfo.Key == StrDefault, keyInfo.IsLegacy); _simpleDataLayers.Add(keyInfo.Key, simpleDataLayer); _tables.Add(keyInfo.Key, new List <string>()); } return(_reflectionDictionaries[keyInfo.Key]); }
ReflectionDictionary GetDictionary(KeyInfo keyInfo) { if (!_reflectionDictionaries.ContainsKey(keyInfo.Key)) { var reflectionDictionary = new ReflectionDictionary(); _reflectionDictionaries.Add(keyInfo.Key, reflectionDictionary); var simpleDataLayer = new DataStoreManagerSimpleDataLayer(reflectionDictionary, GetConnectionProvider(keyInfo.Key), keyInfo.Key == StrDefault, keyInfo.IsLegacy); _simpleDataLayers.Add(keyInfo.Key, simpleDataLayer); _tables.Add(keyInfo.Key, new List<string>()); } return _reflectionDictionaries[keyInfo.Key]; }
public DataStoreManagerSimpleDataLayer GetDataLayer(string key,IDataStore defaultStore){ if (!_simpleDataLayers.ContainsKey(key)){ var keyValuePair = _reflectionDictionaries.First(info => info.Key.Key==key); var connectionProvider = keyValuePair.Key.Key==StrDefault?defaultStore:GetConnectionProvider(keyValuePair.Key.Key); var simpleDataLayer = new DataStoreManagerSimpleDataLayer(keyValuePair.Value, connectionProvider, keyValuePair.Key.Key == StrDefault, keyValuePair.Key.IsLegacy); _simpleDataLayers.Add(keyValuePair.Key.Key, simpleDataLayer); } return _simpleDataLayers[key]; }