public TypeModel GetTypeModel(Type type) { TypeModel model = (TypeModel)models[type]; if (model != null) return model; TypeDesc typeDesc = typeScope.GetTypeDesc(type); switch (typeDesc.Kind) { case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; case TypeKind.Root: case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: model = new StructModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) throw new NotSupportedException(Res.GetString(Res.XmlUnsupportedTypeKind, type.FullName)); model = new SpecialModel(type, typeDesc, this); break; } models.Add(type, model); return model; }
private PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, string dataType) { PrimitiveMapping mapping = new PrimitiveMapping(); mapping.IsSoap = true; if (dataType.Length > 0) { mapping.TypeDesc = _typeScope.GetTypeDesc(dataType, XmlSchema.Namespace); if (mapping.TypeDesc == null) { // try it as a non-Xsd type mapping.TypeDesc = _typeScope.GetTypeDesc(dataType, UrtTypes.Namespace); if (mapping.TypeDesc == null) { throw new InvalidOperationException(SR.Format(SR.XmlUdeclaredXsdType, dataType)); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; return(mapping); }
internal TypeModel GetTypeModel(Type type, bool directReference) { TypeModel model; if (_models.TryGetValue(type, out model)) return model; TypeDesc typeDesc = _typeScope.GetTypeDesc(type, null, directReference); switch (typeDesc.Kind) { case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; case TypeKind.Root: case TypeKind.Class: case TypeKind.Struct: model = new StructModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) throw new NotSupportedException(SR.Format(SR.XmlUnsupportedTypeKind, type.FullName)); model = new SpecialModel(type, typeDesc, this); break; } _models.Add(type, model); return model; }
PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, string dataType) { PrimitiveMapping mapping = new PrimitiveMapping(); mapping.IsSoap = true; if (dataType.Length > 0) { mapping.TypeDesc = typeScope.GetTypeDesc(new XmlQualifiedName(dataType, XmlSchema.Namespace)); if (mapping.TypeDesc == null) { // try it as a non-Xsd type mapping.TypeDesc = typeScope.GetTypeDesc(new XmlQualifiedName(dataType, UrtTypes.Namespace)); if (mapping.TypeDesc == null) { throw new InvalidOperationException(Res.GetString(Res.XmlUdeclaredXsdType, dataType)); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; if (mapping.TypeDesc.IsXsdType && mapping.TypeName == "hexBinary") { throw new NotSupportedException(Res.GetString(Res.XmlUnsupportedSoapTypeKind, mapping.TypeName)); } return(mapping); }
private PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, string dataType) { PrimitiveMapping mapping = new PrimitiveMapping { IsSoap = true }; if (dataType.Length > 0) { mapping.TypeDesc = this.typeScope.GetTypeDesc(dataType, "http://www.w3.org/2001/XMLSchema"); if (mapping.TypeDesc == null) { mapping.TypeDesc = this.typeScope.GetTypeDesc(dataType, "http://microsoft.com/wsdl/types/"); if (mapping.TypeDesc == null) { throw new InvalidOperationException(Res.GetString("XmlUdeclaredXsdType", new object[] { dataType })); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.Namespace = mapping.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/"; return(mapping); }
public TypeModel GetTypeModel(Type type) { TypeModel model = (TypeModel)models[type]; if (model != null) { return(model); } TypeDesc typeDesc = typeScope.GetTypeDesc(type); switch (typeDesc.Kind) { case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; case TypeKind.Root: case TypeKind.Class: case TypeKind.Struct: case TypeKind.Interface: model = new StructModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) { throw new NotSupportedException(Res.GetString(Res.XmlUnsupportedTypeKind, type.FullName)); } model = new SpecialModel(type, typeDesc, this); break; } models.Add(type, model); return(model); }
internal TypeModel GetTypeModel(Type type, bool directReference) { TypeModel?model; if (_models.TryGetValue(type, out model)) { return(model); } TypeDesc typeDesc = _typeScope.GetTypeDesc(type, null, directReference); switch (typeDesc.Kind) { case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; case TypeKind.Root: case TypeKind.Class: case TypeKind.Struct: model = new StructModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) { throw new NotSupportedException(SR.Format(SR.XmlUnsupportedTypeKind, type.FullName)); } model = new SpecialModel(type, typeDesc, this); break; } _models.Add(type, model); return(model); }
internal TypeModel GetTypeModel(Type type, bool directReference) { TypeModel model = (TypeModel)this.models[type]; if (model == null) { TypeDesc typeDesc = this.typeScope.GetTypeDesc(type, null, directReference); switch (typeDesc.Kind) { case TypeKind.Root: case TypeKind.Struct: case TypeKind.Class: model = new StructModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) { throw new NotSupportedException(Res.GetString("XmlUnsupportedTypeKind", new object[] { type.FullName })); } model = new SpecialModel(type, typeDesc, this); break; } this.models.Add(type, model); } return(model); }
internal TypeModel GetTypeModel(Type type, bool directReference) { TypeModel model = (TypeModel) this.models[type]; if (model == null) { TypeDesc typeDesc = this.typeScope.GetTypeDesc(type, null, directReference); switch (typeDesc.Kind) { case TypeKind.Root: case TypeKind.Struct: case TypeKind.Class: model = new StructModel(type, typeDesc, this); break; case TypeKind.Primitive: model = new PrimitiveModel(type, typeDesc, this); break; case TypeKind.Enum: model = new EnumModel(type, typeDesc, this); break; case TypeKind.Array: case TypeKind.Collection: case TypeKind.Enumerable: model = new ArrayModel(type, typeDesc, this); break; default: if (!typeDesc.IsSpecial) { throw new NotSupportedException(Res.GetString("XmlUnsupportedTypeKind", new object[] { type.FullName })); } model = new SpecialModel(type, typeDesc, this); break; } this.models.Add(type, model); } return model; }
PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, string dataType) { PrimitiveMapping mapping = new PrimitiveMapping(); mapping.IsSoap = true; if (dataType.Length > 0) { mapping.TypeDesc = typeScope.GetTypeDesc(dataType, XmlSchema.Namespace); if (mapping.TypeDesc == null) { // try it as a non-Xsd type mapping.TypeDesc = typeScope.GetTypeDesc(dataType, UrtTypes.Namespace); if (mapping.TypeDesc == null) { throw new InvalidOperationException(Res.GetString(Res.XmlUdeclaredXsdType, dataType)); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; return mapping; }
PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, ImportContext context, string dataType, bool repeats) { PrimitiveMapping mapping = new PrimitiveMapping(); if (dataType.Length > 0) { mapping.TypeDesc = typeScope.GetTypeDesc(new XmlQualifiedName(dataType, XmlSchema.Namespace)); if (mapping.TypeDesc == null) { // try it as a non-Xsd type mapping.TypeDesc = typeScope.GetTypeDesc(new XmlQualifiedName(dataType, UrtTypes.Namespace)); if (mapping.TypeDesc == null) { throw new InvalidOperationException(Res.GetString(Res.XmlUdeclaredXsdType, dataType)); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.IsList = repeats; CheckContext(mapping.TypeDesc, context); return mapping; }
private PrimitiveMapping ImportPrimitiveMapping(PrimitiveModel model, ImportContext context, string dataType, bool repeats) { PrimitiveMapping mapping = new PrimitiveMapping(); if (dataType.Length > 0) { mapping.TypeDesc = this.typeScope.GetTypeDesc(dataType, "http://www.w3.org/2001/XMLSchema"); if (mapping.TypeDesc == null) { mapping.TypeDesc = this.typeScope.GetTypeDesc(dataType, "http://microsoft.com/wsdl/types/"); if (mapping.TypeDesc == null) { throw new InvalidOperationException(Res.GetString("XmlUdeclaredXsdType", new object[] { dataType })); } } } else { mapping.TypeDesc = model.TypeDesc; } mapping.TypeName = mapping.TypeDesc.DataType.Name; mapping.Namespace = mapping.TypeDesc.IsXsdType ? "http://www.w3.org/2001/XMLSchema" : "http://microsoft.com/wsdl/types/"; mapping.IsList = repeats; this.CheckContext(mapping.TypeDesc, context); return mapping; }