public static AssociationType AddAssociationType( this EdmModel model, string name, EntityType sourceEntityType, RelationshipMultiplicity sourceAssociationEndKind, EntityType targetEntityType, RelationshipMultiplicity targetAssociationEndKind) { DebugCheck.NotNull(model); DebugCheck.NotEmpty(name); DebugCheck.NotNull(sourceEntityType); DebugCheck.NotNull(targetEntityType); Debug.Assert(model.Namespaces.Count == 1); var associationType = new AssociationType( name, XmlConstants.GetCsdlNamespace(model.Version), false, DataSpace.CSpace) { SourceEnd = new AssociationEndMember( name + "_Source", new RefType(sourceEntityType), sourceAssociationEndKind), TargetEnd = new AssociationEndMember( name + "_Target", new RefType(targetEntityType), targetAssociationEndKind) }; model.AddAssociationType(associationType); return(associationType); }
internal void WriteSchemaElementHeader(string schemaNamespace, string provider, string providerManifestToken) { var xmlNamespace = XmlConstants.GetSsdlNamespace(_version); _xmlWriter.WriteStartElement(XmlConstants.Schema, xmlNamespace); _xmlWriter.WriteAttributeString(XmlConstants.Namespace, schemaNamespace + "Schema"); _xmlWriter.WriteAttributeString(XmlConstants.Provider, provider); _xmlWriter.WriteAttributeString(XmlConstants.ProviderManifestToken, providerManifestToken); _xmlWriter.WriteAttributeString(XmlConstants.Alias, XmlConstants.Self); }
internal void WriteSchemaElementHeader(string schemaNamespace) { var xmlNamespace = XmlConstants.GetCsdlNamespace(_version); _xmlWriter.WriteStartElement(XmlConstants.Schema, xmlNamespace); _xmlWriter.WriteAttributeString(XmlConstants.Namespace, schemaNamespace); _xmlWriter.WriteAttributeString(XmlConstants.Alias, XmlConstants.Self); if (_version == XmlConstants.EdmVersionForV3) { _xmlWriter.WriteAttributeString( XmlConstants.UseStrongSpatialTypes, XmlConstants.AnnotationNamespace, XmlConstants.False); } }
public static ComplexType AddComplexType(this EdmModel model, string name) { DebugCheck.NotNull(model); DebugCheck.NotEmpty(name); Debug.Assert(model.Namespaces.Count == 1); var complexType = new ComplexType( name, XmlConstants.GetCsdlNamespace(model.Version), DataSpace.CSpace); model.Namespaces.Single().ComplexTypes.Add(complexType); return(complexType); }
public static EnumType AddEnumType(this EdmModel model, string name) { DebugCheck.NotNull(model); DebugCheck.NotEmpty(name); Debug.Assert(model.Namespaces.Count == 1); var enumType = new EnumType( name, XmlConstants.GetCsdlNamespace(model.Version), PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32), false, DataSpace.CSpace); model.Namespaces.Single().EnumTypes.Add(enumType); return(enumType); }
// virtual for testing internal virtual void WriteSchemaElementHeader(string schemaNamespace) { DebugCheck.NotEmpty(schemaNamespace); var xmlNamespace = XmlConstants.GetCsdlNamespace(_version); _xmlWriter.WriteStartElement(XmlConstants.Schema, xmlNamespace); _xmlWriter.WriteAttributeString(XmlConstants.Namespace, schemaNamespace); _xmlWriter.WriteAttributeString(XmlConstants.Alias, XmlConstants.Self); if (_version == XmlConstants.EdmVersionForV3) { _xmlWriter.WriteAttributeString( AnnotationNamespacePrefix, XmlConstants.UseStrongSpatialTypes, XmlConstants.AnnotationNamespace, XmlConstants.False); } _xmlWriter.WriteAttributeString("xmlns", AnnotationNamespacePrefix, null, XmlConstants.AnnotationNamespace); }