public bool CanImport(XmlSchemaSet schemas) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } return(InternalCanImport(schemas, null, null)); }
public void Import(XmlSchemaSet schemas) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } InternalImport(schemas, null, null); }
internal HashSet <string> GetMemberNames() { if (ReferencedTypeExists) { throw ExceptionUtil.ThrowHelperError(new InvalidOperationException(SR.Format(SR.CannotSetMembersForReferencedType, TypeReference?.BaseType))); } else { return(_memberNames ??= new HashSet <string>(StringComparer.OrdinalIgnoreCase)); } }
public bool CanImport(XmlSchemaSet schemas, XmlQualifiedName typeName) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } if (typeName == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeName))); } return(InternalCanImport(schemas, new XmlQualifiedName[] { typeName }, null)); }
public bool CanImport(XmlSchemaSet schemas, ICollection <XmlQualifiedName> typeNames) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } if (typeNames == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeNames))); } return(InternalCanImport(schemas, typeNames, null)); }
public CodeTypeReference GetCodeTypeReference(XmlQualifiedName typeName, XmlSchemaElement element) { if (element == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(element))); } if (typeName == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeName))); } DataContract dataContract = FindDataContract(typeName); CodeExporter codeExporter = new CodeExporter(DataContractSet, Options, CodeCompileUnit); return(codeExporter.GetElementTypeReference(dataContract, element.IsNillable)); }
public bool CanImport(XmlSchemaSet schemas, XmlSchemaElement element) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } if (element == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(element))); } SingleElementArray[0] = element; return(InternalCanImport(schemas, s_emptyTypeNameArray, SingleElementArray)); }
public void Import(XmlSchemaSet schemas, XmlQualifiedName typeName) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } if (typeName == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeName))); } SingleTypeNameArray[0] = typeName; InternalImport(schemas, SingleTypeNameArray, null); }
public XmlQualifiedName?Import(XmlSchemaSet schemas, XmlSchemaElement element) { if (schemas == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(schemas))); } if (element == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(element))); } SingleElementArray[0] = element; IList <XmlQualifiedName>?elementNames = InternalImport(schemas, s_emptyTypeNameArray, SingleElementArray); Debug.Assert(elementNames != null && elementNames.Count > 0); return(elementNames[0]); }
internal DataContract FindDataContract(XmlQualifiedName typeName) { if (typeName == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeName))); } DataContract?dataContract = DataContract.GetBuiltInDataContract(typeName.Name, typeName.Namespace); if (dataContract == null) { dataContract = DataContractSet.GetDataContract(typeName); if (dataContract == null) { throw ExceptionUtil.ThrowHelperError(new InvalidOperationException(SR.Format(SR.TypeHasNotBeenImported, typeName.Name, typeName.Namespace))); } } return(dataContract); }
public ICollection <CodeTypeReference>?GetKnownTypeReferences(XmlQualifiedName typeName) { if (typeName == null) { throw ExceptionUtil.ThrowHelperError(new ArgumentNullException(nameof(typeName))); } DataContract?dataContract = DataContract.GetBuiltInDataContract(typeName.Name, typeName.Namespace); if (dataContract == null) { dataContract = DataContractSet.GetDataContract(typeName); if (dataContract == null) { throw ExceptionUtil.ThrowHelperError(new InvalidOperationException(SR.Format(SR.TypeHasNotBeenImported, typeName.Name, typeName.Namespace))); } } CodeExporter codeExporter = new CodeExporter(DataContractSet, Options, CodeCompileUnit); return(codeExporter.GetKnownTypeReferences(dataContract)); }
internal static XmlQualifiedName ImportActualType(XmlSchemaAnnotation?annotation, XmlQualifiedName defaultTypeName, XmlQualifiedName typeName) { XmlElement?actualTypeElement = ImportAnnotation(annotation, ActualTypeAnnotationName); if (actualTypeElement == null) { return(defaultTypeName); } XmlNode?nameAttribute = actualTypeElement.Attributes.GetNamedItem(ImportGlobals.ActualTypeNameAttribute); if (nameAttribute?.Value == null) { throw ExceptionUtil.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, ImportGlobals.ActualTypeNameAttribute))); } XmlNode?nsAttribute = actualTypeElement.Attributes.GetNamedItem(ImportGlobals.ActualTypeNamespaceAttribute); if (nsAttribute?.Value == null) { throw ExceptionUtil.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.AnnotationAttributeNotFound, ActualTypeAnnotationName.Name, typeName.Name, typeName.Namespace, ImportGlobals.ActualTypeNamespaceAttribute))); } return(new XmlQualifiedName(nameAttribute.Value, nsAttribute.Value)); }