public XmlDataTypeStore(DataTypeDescriptor dataTypeDescriptor, Type dataProviderHelperType, Type dataIdClassType, IEnumerable<XmlDataTypeStoreDataScope> xmlDateTypeStoreDataScopes, bool isGeneratedDataType) { if (dataProviderHelperType == null) throw new ArgumentNullException("dataProviderHelperType"); if (dataIdClassType == null) throw new ArgumentNullException("dataIdClassType"); DataTypeDescriptor = dataTypeDescriptor; DataProviderHelperType = dataProviderHelperType; DataIdClassType = dataIdClassType; IsGeneratedDataType = isGeneratedDataType; _xmlDateTypeStoreDataScopes = xmlDateTypeStoreDataScopes.Evaluate(); var ordering = new List<Func<XElement, IComparable>>(); foreach (string key in dataTypeDescriptor.KeyPropertyNames) { XName localKey = key; ordering.Add(f => (string)f.Attribute(localKey) ?? ""); } Func<IEnumerable<XElement>, IOrderedEnumerable<XElement>> orderer = f => ordering.Skip(1).Aggregate(f.OrderBy(ordering.First()), Enumerable.ThenBy); foreach (XmlDataTypeStoreDataScope xmlDataTypeStoreDataScope in _xmlDateTypeStoreDataScopes) { DataScopeIdentifier dataScopeIdentifier = DataScopeIdentifier.Deserialize(xmlDataTypeStoreDataScope.DataScopeName); CultureInfo culture = CultureInfo.CreateSpecificCulture(xmlDataTypeStoreDataScope.CultureName); Type dataType = dataTypeDescriptor.GetInterfaceType(); Action cacheFlush = () => DataEventSystemFacade.FireExternalStoreChangedEvent(dataType, dataScopeIdentifier.ToPublicationScope(), culture); XmlDataProviderDocumentCache.RegisterExternalFileChangeAction(xmlDataTypeStoreDataScope.Filename, cacheFlush); XmlDataProviderDocumentWriter.RegisterFileOrderer(xmlDataTypeStoreDataScope.Filename, orderer); } }
/// <exclude /> public GeneratedTypesHelper(DataTypeDescriptor oldDataTypeDescriptor) { Verify.ArgumentNotNull(oldDataTypeDescriptor, "oldDataTypeDescriptor"); _oldType = oldDataTypeDescriptor.GetInterfaceType(); _oldDataTypeDescriptor = oldDataTypeDescriptor; Initialize(); }
/// <summary> /// </summary> /// <param name="oldDataTypeDescriptor"></param> /// <param name="newDataTypeDescriptor"></param> /// <param name="originalTypeHasData"></param> public UpdateDataTypeDescriptor(DataTypeDescriptor oldDataTypeDescriptor, DataTypeDescriptor newDataTypeDescriptor, bool originalTypeHasData = true) { OldDataTypeDescriptor = oldDataTypeDescriptor; NewDataTypeDescriptor = newDataTypeDescriptor; var interfaceType = oldDataTypeDescriptor.GetInterfaceType(); ProviderName = interfaceType != null ? DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(interfaceType) .SingleOrException("Failed to get data provider by type '{0}'", "Multiple data providers for type '{0}'", interfaceType.FullName) : DataProviderRegistry.DefaultDynamicTypeDataProviderName; }
/// <summary> /// </summary> /// <param name="oldDataTypeDescriptor"></param> /// <param name="newDataTypeDescriptor"></param> /// <param name="originalTypeHasData"></param> public UpdateDataTypeDescriptor(DataTypeDescriptor oldDataTypeDescriptor, DataTypeDescriptor newDataTypeDescriptor, bool originalTypeHasData = true) { OldDataTypeDescriptor = oldDataTypeDescriptor; NewDataTypeDescriptor = newDataTypeDescriptor; var interfaceType = oldDataTypeDescriptor.GetInterfaceType(); ProviderName = interfaceType != null ? DataProviderRegistry.GetWriteableDataProviderNamesByInterfaceType(interfaceType) .SingleOrException("Failed to get data provider by type '{0}'", "Multiple data providers for type '{0}'", interfaceType.FullName) : DataProviderRegistry.DefaultDynamicTypeDataProviderName; }
internal static void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush) { if (providerName == null) { providerName = DataProviderRegistry.DefaultDynamicTypeDataProviderName; } _dynamicTypeManager.DropStore(providerName, typeDescriptor, makeAFlush); var interfaceType = typeDescriptor.GetInterfaceType(); if (interfaceType != null) { DataProviderRegistry.UnregisterDataType(interfaceType, providerName); } }
public void DropStore(DataTypeDescriptor dataTypeDescriptor) { using (TimerProfilerFacade.CreateTimerProfiler()) { SqlStoreManipulator.DropStoresForType(_dataProviderContext.ProviderName, dataTypeDescriptor); InterfaceConfigurationManipulator.Remove(_dataProviderContext.ProviderName, dataTypeDescriptor); InterfaceConfigurationElement oldElement = _interfaceConfigurationElements.FirstOrDefault(f => f.DataTypeId == dataTypeDescriptor.DataTypeId); if (oldElement != null) { _interfaceConfigurationElements.Remove(oldElement); } Guid dataTypeId = dataTypeDescriptor.DataTypeId; int storesRemoved = _createdSqlDataTypeStoreTables.RemoveAll(item => item.DataTypeId == dataTypeId); if (storesRemoved > 0) { Type interfaceType = dataTypeDescriptor.GetInterfaceType(); _sqlDataTypeStoresContainer.ForgetInterface(interfaceType); } } }
internal static void DropStore(string providerName, DataTypeDescriptor typeDescriptor, bool makeAFlush) { if (providerName == null) { providerName = DataProviderRegistry.DefaultDynamicTypeDataProviderName; } _dynamicTypeManager.DropStore(providerName, typeDescriptor, makeAFlush); var interfaceType = typeDescriptor.GetInterfaceType(); if (interfaceType != null) { DataProviderRegistry.UnregisterDataType(interfaceType, providerName); } }