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)));
        }
		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));
		}
Beispiel #3
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)));
        }
        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));
        }