internal StoreAssociationSet(EDMXFile parentFile, StorageModel storageModel, string name, StoreEntitySet fromES, StoreEntitySet toES, StoreEntityType fromET, StoreEntityType toET, string fromRoleName, string toRoleName, MultiplicityTypeEnum fromMultiplicity, MultiplicityTypeEnum toMultiplicity, List<Tuple<StoreMemberProperty, StoreMemberProperty>> keys)
            : base(parentFile)
        {
            _storageModel = storageModel;

            _associationSetElement = CreateAssociationSet();
            _associationElement = CreateAssociation(name);

            Name = name;

            FromRoleName = fromRoleName;
            ToRoleName = toRoleName;

            FromEntitySet = fromES;
            FromEntityType = fromET;
            FromMultiplicity = fromMultiplicity;

            ToEntitySet = toES;
            ToEntityType = toET;
            ToMultiplicity = toMultiplicity;

            foreach (Tuple<StoreMemberProperty, StoreMemberProperty> key in keys)
            {
                AddKey(key.Item1, key.Item2);
            }

            _keysEnumerated = true;
        }
        internal StoreAssociationSet(EDMXFile parentFile, StorageModel storageModel, XmlElement associationSetElement)
            : base(parentFile)
        {
            _storageModel = storageModel;
            _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("ssdl:Association[@Name=" + XmlHelpers.XPathLiteral(associationName) + "]", NSM);
                }
            }

            if (_associationElement == null)
            {
                throw new InvalidModelObjectException("The StoreAssociationSet " + (associationName ?? "[unknown]") + " has no corresponding association element.");
            }
        }
        internal StoreAssociationSet(EDMXFile parentFile, StorageModel storageModel, string name, StoreEntitySet fromES, StoreEntitySet toES, StoreEntityType fromET, StoreEntityType toET, string fromRoleName, string toRoleName, MultiplicityTypeEnum fromMultiplicity, MultiplicityTypeEnum toMultiplicity, List <Tuple <StoreMemberProperty, StoreMemberProperty> > keys)
            : base(parentFile)
        {
            _storageModel = storageModel;

            _associationSetElement = CreateAssociationSet();
            _associationElement    = CreateAssociation(name);

            Name = name;

            FromRoleName = fromRoleName;
            ToRoleName   = toRoleName;

            FromEntitySet    = fromES;
            FromEntityType   = fromET;
            FromMultiplicity = fromMultiplicity;

            ToEntitySet    = toES;
            ToEntityType   = toET;
            ToMultiplicity = toMultiplicity;

            foreach (Tuple <StoreMemberProperty, StoreMemberProperty> key in keys)
            {
                AddKey(key.Item1, key.Item2);
            }

            _keysEnumerated = true;
        }
        internal StoreAssociationSet(EDMXFile parentFile, StorageModel storageModel, XmlElement associationSetElement)
            : base(parentFile)
        {
            _storageModel          = storageModel;
            _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("ssdl:Association[@Name=" + XmlHelpers.XPathLiteral(associationName) + "]", NSM);
                }
            }

            if (_associationElement == null)
            {
                throw new InvalidModelObjectException("The StoreAssociationSet " + (associationName ?? "[unknown]") + " has no corresponding association element.");
            }
        }
        internal StoreEntitySet(EDMXFile parentFile, StorageModel storageModel, string name) : base(parentFile)
        {
            _storageModel = storageModel;

            //create and add the entity set element
            XmlElement setContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityContainer", NSM);

            _entitySetElement = EDMXDocument.CreateElement("EntitySet", NameSpaceURIssdl);
            setContainer.AppendChild(_entitySetElement);

            this.Name = name;
        }
        internal StoreEntityType(EDMXFile parentFile, StorageModel storageModel, string name)
            : base(parentFile)
        {
            _storageModel = storageModel;

            //create the entity type element
            XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema", NSM);
            _entityTypeElement = EDMXDocument.CreateElement("EntityType", NameSpaceURIssdl);
            schemaContainer.AppendChild(_entityTypeElement);

            Name = name;
        }
        internal StoreFunction(EDMXFile ParentFile, StorageModel storageModel, string name)
            : base(ParentFile)
        {
            _storageModel = storageModel;

            //create and add the function element
            XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema", NSM);
            _functionElement = EDMXDocument.CreateElement("Function", NameSpaceURIssdl);
            schemaContainer.AppendChild(_functionElement);

            this.Name = name;
        }
        internal StoreEntityType(EDMXFile parentFile, StorageModel storageModel, string name) : base(parentFile)
        {
            _storageModel = storageModel;

            //create the entity type element
            XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema", NSM);

            _entityTypeElement = EDMXDocument.CreateElement("EntityType", NameSpaceURIssdl);
            schemaContainer.AppendChild(_entityTypeElement);

            Name = name;
        }
        internal StoreEntitySet(EDMXFile parentFile, StorageModel storageModel, string name)
            : base(parentFile)
        {
            _storageModel = storageModel;

            //create and add the entity set element
            XmlElement setContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema/ssdl:EntityContainer", NSM);
            _entitySetElement = EDMXDocument.CreateElement("EntitySet", NameSpaceURIssdl);
            setContainer.AppendChild(_entitySetElement);

            this.Name = name;
        }
Example #10
0
        internal StoreFunction(EDMXFile ParentFile, StorageModel storageModel, string name)
            : base(ParentFile)
        {
            _storageModel = storageModel;

            //create and add the function element
            XmlElement schemaContainer = (XmlElement)EDMXDocument.DocumentElement.SelectSingleNode("edmx:Runtime/edmx:StorageModels/ssdl:Schema", NSM);

            _functionElement = EDMXDocument.CreateElement("Function", NameSpaceURIssdl);
            schemaContainer.AppendChild(_functionElement);

            this.Name = name;
        }
 internal StoreEntitySet(EDMXFile parentFile, StorageModel storageModel, XmlElement entitySetElement) : base(parentFile)
 {
     _storageModel     = storageModel;
     _entitySetElement = entitySetElement;
 }
Example #12
0
 internal StoreFunction(EDMXFile ParentFile, StorageModel storageModel, XmlElement functionElement)
     : base(ParentFile)
 {
     _storageModel    = storageModel;
     _functionElement = functionElement;
 }
Example #13
0
 internal StorageModelQueries(StorageModel storageModel)
 {
     _storageModel = storageModel;
 }
 internal StoreEntityType(EDMXFile parentFile, StorageModel storageModel, XmlElement entityTypeElement)
     : base(parentFile)
 {
     _storageModel = storageModel;
     _entityTypeElement = entityTypeElement;
 }
 internal StoreFunction(EDMXFile ParentFile, StorageModel storageModel, XmlElement functionElement)
     : base(ParentFile)
 {
     _storageModel = storageModel;
     _functionElement = functionElement;
 }