internal ModelAssociationSet(EDMXFile parentFile, ConceptualModel conceptualModel, XmlElement associationSetElement) : base(parentFile) { _conceptualModel = conceptualModel; _associationSetElement = associationSetElement; string associationName = _associationSetElement.GetAttribute("Association"); if (!string.IsNullOrEmpty(associationName)) { if (_associationSetElement.ParentNode != null && _associationSetElement.ParentNode.ParentNode != null) { XmlElement schemaElement = (XmlElement)_associationSetElement.ParentNode.ParentNode; string schemaNamespace = schemaElement.GetAttribute("Namespace"); string schemaAlias = schemaElement.GetAttribute("Alias"); if (!string.IsNullOrEmpty(schemaNamespace) && associationName.StartsWith(schemaNamespace)) { associationName = associationName.Substring(schemaNamespace.Length + 1); } else if (!string.IsNullOrEmpty(schemaAlias) && associationName.StartsWith(schemaAlias)) { associationName = associationName.Substring(schemaAlias.Length + 1); } _associationElement = (XmlElement)_associationSetElement.ParentNode.ParentNode.SelectSingleNode("edm:Association[@Name=" + XmlHelpers.XPathLiteral(associationName) + "]", NSM); } } if (_associationElement == null) { throw new InvalidModelObjectException("The ModelAssociationSet " + (associationName ?? "[unknown]") + " has no corresponding association element."); } }
internal ModelFunction(EDMXFile parentFile, ConceptualModel conceptualModel, string name) : base(parentFile) { _conceptualModel = conceptualModel; //create the entity type element XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:ConceptualModels/edm:Schema/edm:EntityContainer", NSM); _functionImportElement = EDMXDocument.CreateElement("FunctionImport", NameSpaceURIcsdl); schemaContainer.AppendChild(_functionImportElement); Name = name; }
internal ModelEntitySet(EDMXFile parentFile, ConceptualModel conceptualModel, string name) : base(parentFile) { _conceptualModel = conceptualModel; //create and add the entity set element XmlElement setContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:ConceptualModels/edm:Schema/edm:EntityContainer", NSM); _entitySetElement = EDMXDocument.CreateElement("EntitySet", NameSpaceURIcsdl); setContainer.AppendChild(_entitySetElement); Name = name; }
internal ModelEntityType(EDMXFile parentFile, ConceptualModel conceptualModel, string name, ModelEntityType baseType) : base(parentFile) { _conceptualModel = conceptualModel; //create the entity type element XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:ConceptualModels/edm:Schema", NSM); _entityTypeElement = EDMXDocument.CreateElement("EntityType", NameSpaceURIcsdl); schemaContainer.AppendChild(_entityTypeElement); BaseType = baseType; Name = name; }
internal ModelAssociationSet(EDMXFile parentFile, ConceptualModel conceptualModel, string name, ModelEntitySet fromES, ModelEntitySet toES, ModelEntityType fromET, ModelEntityType toET, MultiplicityTypeEnum fromMultiplicity, MultiplicityTypeEnum toMultiplicity, string fromNavProperty, string toNavProperty, List <Tuple <ModelMemberProperty, ModelMemberProperty> > keys) : base(parentFile) { _conceptualModel = conceptualModel; bool manyToMany = (fromMultiplicity == MultiplicityTypeEnum.Many && toMultiplicity == MultiplicityTypeEnum.Many); _associationSetElement = CreateAssociationSet(); _associationElement = CreateAssociation(name, manyToMany); Name = name; //set from/to sets and multiplicity FromEntitySet = fromES; FromEntityType = fromET; FromMultiplicity = fromMultiplicity; ToEntitySet = toES; ToEntityType = toET; ToMultiplicity = toMultiplicity; //add navigation properties if (!string.IsNullOrEmpty(fromNavProperty)) { fromET.AddNavigationMember(fromNavProperty, this, FromRoleName, ToRoleName); } if (!string.IsNullOrEmpty(toNavProperty)) { toET.AddNavigationMember(toNavProperty, this, ToRoleName, FromRoleName); } if (keys != null) { foreach (Tuple <ModelMemberProperty, ModelMemberProperty> key in keys) { AddKey(key.Item1, key.Item2); } } _keysEnumerated = true; }
internal ModelAssociationSet(EDMXFile parentFile, ConceptualModel conceptualModel, string name, ModelEntitySet fromES, ModelEntitySet toES, ModelEntityType fromET, ModelEntityType toET, MultiplicityTypeEnum fromMultiplicity, MultiplicityTypeEnum toMultiplicity, string fromNavProperty, string toNavProperty, List<Tuple<ModelMemberProperty, ModelMemberProperty>> keys) : base(parentFile) { _conceptualModel = conceptualModel; bool manyToMany = (fromMultiplicity == MultiplicityTypeEnum.Many && toMultiplicity == MultiplicityTypeEnum.Many); _associationSetElement = CreateAssociationSet(); _associationElement = CreateAssociation(name, manyToMany); Name = name; //set from/to sets and multiplicity FromEntitySet = fromES; FromEntityType = fromET; FromMultiplicity = fromMultiplicity; ToEntitySet = toES; ToEntityType = toET; ToMultiplicity = toMultiplicity; //add navigation properties if (!string.IsNullOrEmpty(fromNavProperty)) { fromET.AddNavigationMember(fromNavProperty, this, FromRoleName, ToRoleName); } if (!string.IsNullOrEmpty(toNavProperty)) { toET.AddNavigationMember(toNavProperty, this, ToRoleName, FromRoleName); } if (keys != null) { foreach (Tuple<ModelMemberProperty, ModelMemberProperty> key in keys) { AddKey(key.Item1, key.Item2); } } _keysEnumerated = true; }
internal ModelEntityType(EDMXFile parentFile, ConceptualModel conceptualModel, System.Xml.XmlElement entityTypeElement) : base(parentFile) { _conceptualModel = conceptualModel; _entityTypeElement = entityTypeElement; }
internal ConceptualModelQueries(ConceptualModel conceptualModel) { _conceptualModel = conceptualModel; }
internal ModelFunction(EDMXFile parentFile, ConceptualModel conceptualModel, System.Xml.XmlElement functionImportElement) : base(parentFile) { _conceptualModel = conceptualModel; _functionImportElement = functionImportElement; }
internal ModelEntitySet(EDMXFile parentFile, ConceptualModel conceptualModel, System.Xml.XmlElement entitySetElement) : base(parentFile) { _conceptualModel = conceptualModel; _entitySetElement = entitySetElement; }
internal ConceptualModelQueries(ConceptualModel conceptualModel) { _conceptualModel = conceptualModel; }
internal ModelComplexType(EDMXFile parentFile, ConceptualModel conceptualModel, System.Xml.XmlElement entityTypeElement) : base(parentFile) { _conceptualModel = conceptualModel; _complexTypeElement = entityTypeElement; }
internal ModelFunction(EDMXFile parentFile, ConceptualModel conceptualModel, System.Xml.XmlElement functionImportElement) : base(parentFile) { _conceptualModel = conceptualModel; _functionImportElement = functionImportElement; }