public CsdlSemanticsAssociationSetEnd(CsdlSemanticsAssociationSet context, CsdlAssociationSetEnd end, IEdmAssociationEnd role)
     : base(end)
 {
     this.context = context;
     this.end = end;
     this.role = role;
 }
 public CsdlSemanticsAssociationSetEnd(CsdlSemanticsAssociationSet context, CsdlAssociationSetEnd end, IEdmAssociationEnd role)
     : base(end)
 {
     this.context = context;
     this.end     = end;
     this.role    = role;
 }
        private TupleInternal <CsdlSemanticsAssociationSetEnd, CsdlSemanticsAssociationSetEnd> ComputeEnds()
        {
            CsdlAssociationSetEnd setEnd1  = this.associationSet.End1;
            CsdlAssociationSetEnd setEnd2  = this.associationSet.End2;
            IEdmAssociationEnd    end1Role = null;
            IEdmAssociationEnd    end2Role = null;
            bool end1Bad = false;
            bool end2Bad = false;

            if (setEnd1 != null)
            {
                end1Role = this.GetRole(setEnd1);
                end1Bad  = end1Role is IUnresolvedElement;
            }

            if (setEnd2 != null)
            {
                end2Role = this.GetRole(setEnd2);
                end2Bad  = end2Role is IUnresolvedElement;
            }

            // This is not an else statement above because the logic here depends on end2 having been calculated.
            if (setEnd1 == null)
            {
                if (end2Bad)
                {
                    end1Role = new UnresolvedAssociationEnd(this.Association, "End1", this.Location);
                    end1Bad  = true;
                }
                else
                {
                    if (end2Role != null)
                    {
                        end1Role = (end2Role != this.Association.End1) ? this.Association.End1 : this.Association.End2;
                    }
                    else
                    {
                        end1Role = this.Association.End1;
                    }
                }
            }

            // This is not an else statement above because the logic here depends on end1 having been calculated.
            if (setEnd2 == null)
            {
                if (end1Bad)
                {
                    end2Role = new UnresolvedAssociationEnd(this.Association, "End2", this.Location);
                    end2Bad  = true;
                }
                else
                {
                    end2Role = (end1Role != this.Association.End1) ? this.Association.End1 : this.Association.End2;
                }
            }

            return(TupleInternal.Create(
                       new CsdlSemanticsAssociationSetEnd(this, this.associationSet.End1, end1Role),
                       new CsdlSemanticsAssociationSetEnd(this, this.associationSet.End2, end2Role)));
        }
 public CsdlSemanticsAssociationSetEnd(CsdlSemanticsAssociationSet context, CsdlAssociationSetEnd end, IEdmAssociationEnd role) : base(end)
 {
     this.entitySet   = new Cache <CsdlSemanticsAssociationSetEnd, IEdmEntitySet>();
     this.errorsCache = new Cache <CsdlSemanticsAssociationSetEnd, IEnumerable <EdmError> >();
     this.context     = context;
     this.end         = end;
     this.role        = role;
 }
		public CsdlSemanticsAssociationSetEnd(CsdlSemanticsAssociationSet context, CsdlAssociationSetEnd end, IEdmAssociationEnd role) : base(end)
		{
			this.entitySet = new Cache<CsdlSemanticsAssociationSetEnd, IEdmEntitySet>();
			this.errorsCache = new Cache<CsdlSemanticsAssociationSetEnd, IEnumerable<EdmError>>();
			this.context = context;
			this.end = end;
			this.role = role;
		}
        private IEdmAssociationEnd ComputePrincipal()
        {
            IEdmAssociationEnd returnedEnd = this.context.End1;

            if (returnedEnd.Name != this.constraint.Principal.Role)
            {
                returnedEnd = this.context.End2;
            }

            if (returnedEnd.Name != this.constraint.Principal.Role)
            {
                returnedEnd = new BadAssociationEnd(this.context, this.constraint.Principal.Role, new EdmError[] { new EdmError(this.Location, EdmErrorCode.BadNonComputableAssociationEnd, Edm.Strings.Bad_UncomputableAssociationEnd(this.constraint.Principal.Role)) });
            }

            return(returnedEnd);
        }
        private IEdmAssociationEnd ComputePrincipal()
        {
            IEdmAssociationEnd end1 = this.context.End1;

            if (end1.Name != this.constraint.Principal.Role)
            {
                end1 = this.context.End2;
            }
            if (end1.Name != this.constraint.Principal.Role)
            {
                EdmError[] edmError = new EdmError[1];
                edmError[0] = new EdmError(base.Location, EdmErrorCode.BadNonComputableAssociationEnd, Strings.Bad_UncomputableAssociationEnd(this.constraint.Principal.Role));
                end1        = new BadAssociationEnd(this.context, this.constraint.Principal.Role, edmError);
            }
            return(end1);
        }
Esempio n. 8
0
        private TupleInternal <CsdlSemanticsAssociationSetEnd, CsdlSemanticsAssociationSetEnd> ComputeEnds()
        {
            IEdmAssociationEnd    end1;
            IEdmAssociationEnd    end2;
            CsdlAssociationSetEnd csdlAssociationSetEnd = this.associationSet.End1;
            CsdlAssociationSetEnd end21 = this.associationSet.End2;
            IEdmAssociationEnd    role  = null;
            IEdmAssociationEnd    unresolvedAssociationEnd = null;
            bool flag  = false;
            bool flag1 = false;

            if (csdlAssociationSetEnd != null)
            {
                role = this.GetRole(csdlAssociationSetEnd);
                flag = role is IUnresolvedElement;
            }
            if (end21 != null)
            {
                unresolvedAssociationEnd = this.GetRole(end21);
                flag1 = unresolvedAssociationEnd is IUnresolvedElement;
            }
            if (csdlAssociationSetEnd == null)
            {
                if (!flag1)
                {
                    if (unresolvedAssociationEnd == null)
                    {
                        role = this.Association.End1;
                    }
                    else
                    {
                        if (unresolvedAssociationEnd != this.Association.End1)
                        {
                            end2 = this.Association.End1;
                        }
                        else
                        {
                            end2 = this.Association.End2;
                        }
                        role = end2;
                    }
                }
                else
                {
                    role = new UnresolvedAssociationEnd(this.Association, "End1", base.Location);
                    flag = true;
                }
            }
            if (end21 == null)
            {
                if (!flag)
                {
                    if (role != this.Association.End1)
                    {
                        end1 = this.Association.End1;
                    }
                    else
                    {
                        end1 = this.Association.End2;
                    }
                    unresolvedAssociationEnd = end1;
                }
                else
                {
                    unresolvedAssociationEnd = new UnresolvedAssociationEnd(this.Association, "End2", base.Location);
                }
            }
            return(TupleInternal.Create <CsdlSemanticsAssociationSetEnd, CsdlSemanticsAssociationSetEnd>(new CsdlSemanticsAssociationSetEnd(this, this.associationSet.End1, role), new CsdlSemanticsAssociationSetEnd(this, this.associationSet.End2, unresolvedAssociationEnd)));
        }