Exemplo n.º 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);
        }
        internal override SchemaElement Clone(SchemaElement parentElement)
        {
            var setEnd = new EntityContainerAssociationSetEnd((EntityContainerAssociationSet)parentElement);

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

            return(setEnd);
        }
Exemplo n.º 3
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);
            }
        }
        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)
        {
            Debug.Assert(reader != null);

            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)
        {
            Debug.Assert(relationshipEnd != null);
            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);
            }
        }