Example #1
0
        // <summary>
        // The method that is called when an End element is encountered.
        // </summary>
        // <param name="reader"> The XmlReader positioned at the EndElement. </param>
        private void HandleEndElement(XmlReader reader)
        {
            DebugCheck.NotNull(reader);

            var end = new EntityContainerAssociationSetEnd(this);

            end.Parse(reader);

            if (end.Role == null)
            {
                // we will resolve the role name later and put it in the
                // normal _relationshipEnds dictionary
                _rolelessEnds.Add(end);
                return;
            }

            if (HasEnd(end.Role))
            {
                end.AddError(
                    ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader,
                    Strings.DuplicateEndName(end.Name));
                return;
            }

            _relationshipEnds.Add(end.Role, end);
        }
Example #2
0
        internal override SchemaElement Clone(SchemaElement parentElement)
        {
            EntityContainerAssociationSetEnd associationSetEnd = new EntityContainerAssociationSetEnd((EntityContainerAssociationSet)parentElement);

            associationSetEnd._unresolvedRelationshipEndRole = this._unresolvedRelationshipEndRole;
            associationSetEnd.EntitySet = this.EntitySet;
            return((SchemaElement)associationSetEnd);
        }
Example #3
0
        internal override SchemaElement Clone(SchemaElement parentElement)
        {
            var setEnd = new EntityContainerAssociationSetEnd((EntityContainerAssociationSet)parentElement);

            setEnd._unresolvedRelationshipEndRole = _unresolvedRelationshipEndRole;
            setEnd.EntitySet = EntitySet;

            return(setEnd);
        }
Example #4
0
        internal override SchemaElement Clone(SchemaElement parentElement)
        {
            EntityContainerAssociationSet containerAssociationSet = new EntityContainerAssociationSet((EntityContainer)parentElement);

            containerAssociationSet.Name         = this.Name;
            containerAssociationSet.Relationship = this.Relationship;
            foreach (SchemaElement end in this.Ends)
            {
                EntityContainerAssociationSetEnd associationSetEnd = (EntityContainerAssociationSetEnd)end.Clone((SchemaElement)containerAssociationSet);
                containerAssociationSet._relationshipEnds.Add(associationSetEnd.Role, associationSetEnd);
            }
            return((SchemaElement)containerAssociationSet);
        }
Example #5
0
        protected override void AddEnd(
            IRelationshipEnd relationshipEnd,
            EntityContainerEntitySet entitySet)
        {
            EntityContainerAssociationSetEnd associationSetEnd = new EntityContainerAssociationSetEnd(this);

            associationSetEnd.Role            = relationshipEnd.Name;
            associationSetEnd.RelationshipEnd = relationshipEnd;
            associationSetEnd.EntitySet       = entitySet;
            if (associationSetEnd.EntitySet == null)
            {
                return;
            }
            this._relationshipEnds.Add(associationSetEnd.Role, associationSetEnd);
        }
Example #6
0
        // <summary>
        // Create and add a EntityContainerEnd from the IRelationshipEnd provided
        // </summary>
        // <param name="relationshipEnd"> The relationship end of the end to add. </param>
        // <param name="entitySet"> The entitySet to associate with the relationship end. </param>
        protected override void AddEnd(IRelationshipEnd relationshipEnd, EntityContainerEntitySet entitySet)
        {
            DebugCheck.NotNull(relationshipEnd);
            Debug.Assert(!_relationshipEnds.ContainsKey(relationshipEnd.Name));
            // we expect set to be null sometimes

            var end = new EntityContainerAssociationSetEnd(this);

            end.Role            = relationshipEnd.Name;
            end.RelationshipEnd = relationshipEnd;

            end.EntitySet = entitySet;
            if (end.EntitySet != null)
            {
                _relationshipEnds.Add(end.Role, end);
            }
        }
Example #7
0
        private void HandleEndElement(XmlReader reader)
        {
            EntityContainerAssociationSetEnd associationSetEnd = new EntityContainerAssociationSetEnd(this);

            associationSetEnd.Parse(reader);
            if (associationSetEnd.Role == null)
            {
                this._rolelessEnds.Add(associationSetEnd);
            }
            else if (this.HasEnd(associationSetEnd.Role))
            {
                associationSetEnd.AddError(ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader, (object)Strings.DuplicateEndName((object)associationSetEnd.Name));
            }
            else
            {
                this._relationshipEnds.Add(associationSetEnd.Role, associationSetEnd);
            }
        }
        internal override SchemaElement Clone(SchemaElement parentElement)
        {
            var setEnd = new EntityContainerAssociationSetEnd((EntityContainerAssociationSet)parentElement);
            setEnd._unresolvedRelationshipEndRole = _unresolvedRelationshipEndRole;
            setEnd.EntitySet = EntitySet;

            return setEnd;
        }
        // <summary>
        // The method that is called when an End element is encountered.
        // </summary>
        // <param name="reader"> The XmlReader positioned at the EndElement. </param>
        private void HandleEndElement(XmlReader reader)
        {
            DebugCheck.NotNull(reader);

            var end = new EntityContainerAssociationSetEnd(this);
            end.Parse(reader);

            if (end.Role == null)
            {
                // we will resolve the role name later and put it in the 
                // normal _relationshipEnds dictionary
                _rolelessEnds.Add(end);
                return;
            }

            if (HasEnd(end.Role))
            {
                end.AddError(
                    ErrorCode.InvalidName, EdmSchemaErrorSeverity.Error, reader,
                    Strings.DuplicateEndName(end.Name));
                return;
            }

            _relationshipEnds.Add(end.Role, end);
        }
        // <summary>
        // Create and add a EntityContainerEnd from the IRelationshipEnd provided
        // </summary>
        // <param name="relationshipEnd"> The relationship end of the end to add. </param>
        // <param name="entitySet"> The entitySet to associate with the relationship end. </param>
        protected override void AddEnd(IRelationshipEnd relationshipEnd, EntityContainerEntitySet entitySet)
        {
            DebugCheck.NotNull(relationshipEnd);
            Debug.Assert(!_relationshipEnds.ContainsKey(relationshipEnd.Name));
            // we expect set to be null sometimes

            var end = new EntityContainerAssociationSetEnd(this);
            end.Role = relationshipEnd.Name;
            end.RelationshipEnd = relationshipEnd;

            end.EntitySet = entitySet;
            if (end.EntitySet != null)
            {
                _relationshipEnds.Add(end.Role, end);
            }
        }