private static DataTypeDescriptor GetDataTypeDescriptorNotNull(XmlProviderInterfaceConfigurationElement element) { Guid dataTypeId = element.DataTypeId; var dataTypeDescriptor = DataMetaDataFacade.GetDataTypeDescriptor(dataTypeId, true); if (dataTypeDescriptor == null) { throw NewConfigurationException(element, "Failed to get a DataTypeDescriptor by id '{0}'".FormatWith(dataTypeId)); } return(dataTypeDescriptor); }
public void AlterStore(UpdateDataTypeDescriptor updateDataTypeDescriptor, bool forceCompile) { XmlDataProviderDocumentCache.ClearCache(); XmlProviderInterfaceConfigurationElement element = InterfaceConfigurationManipulator.Change(updateDataTypeDescriptor); if (forceCompile) { DataTypeDescriptor dataTypeDescriptor = updateDataTypeDescriptor.NewDataTypeDescriptor; Type dataProviderHelperType; Type dataIdClassType; bool typesExists = EnsureNeededTypes(dataTypeDescriptor, out dataProviderHelperType, out dataIdClassType, true); Verify.That(typesExists, "Could not find or code generated the type '{0}' or one of the needed helper types", dataTypeDescriptor.GetFullInterfaceName()); var xmlDataTypeStoreDataScopes = new List <XmlDataTypeStoreDataScope>(); foreach (DataScopeConfigurationElement dataScopeConfigurationElement in element.ConfigurationStores) { var xmlDataTypeStoreDataScope = new XmlDataTypeStoreDataScope { DataScopeName = dataScopeConfigurationElement.DataScope, CultureName = dataScopeConfigurationElement.CultureName, ElementName = dataScopeConfigurationElement.ElementName, Filename = Path.Combine(_fileStoreDirectory, dataScopeConfigurationElement.Filename) }; xmlDataTypeStoreDataScopes.Add(xmlDataTypeStoreDataScope); } var xmlDataTypeStoreCreator = new XmlDataTypeStoreCreator(_fileStoreDirectory); XmlDataTypeStore xmlDateTypeStore = xmlDataTypeStoreCreator.CreateStoreResult(dataTypeDescriptor, dataProviderHelperType, dataIdClassType, xmlDataTypeStoreDataScopes); Type interfaceType = DataTypeTypesManager.GetDataType(dataTypeDescriptor); UpdateDataTypeStore(dataTypeDescriptor, interfaceType, xmlDateTypeStore); } }
internal void Add(XmlProviderInterfaceConfigurationElement element) { BaseAdd(element); }
/// <summary> /// Builds a <see cref="GeneratedTypesInfo"/> object that describes information about helper types generation /// </summary> private GeneratedTypesInfo BuildGeneratedTypesInfo(DataTypeDescriptor dataTypeDescriptor, Type interfaceType, XmlProviderInterfaceConfigurationElement element = null) { string dataProviderHelperClassFullName, dataIdClassFullName; GetGeneratedClassNames(dataTypeDescriptor, out dataProviderHelperClassFullName, out dataIdClassFullName); Type dataProviderHelperClass = TypeManager.TryGetType(dataProviderHelperClassFullName); Type dataIdClass = TypeManager.TryGetType(dataIdClassFullName); bool compilationNeeded = CodeGenerationManager.IsRecompileNeeded(interfaceType, new[] { dataProviderHelperClass, dataIdClass }); return(new GeneratedTypesInfo { Element = element, DataTypeDescriptor = dataTypeDescriptor, InterfaceType = interfaceType, DataIdClass = dataIdClass, DataIdClassName = dataIdClassFullName, DataProviderHelperClass = dataProviderHelperClass, DataProviderHelperClassName = dataProviderHelperClassFullName, CompilationNeeded = compilationNeeded }); }