private IEdmAssociation ComputeAssociation()
        {
            CsdlSemanticsElement csdlSemanticsElement;
            CsdlSemanticsElement csdlSemanticsElement1;
            IEnumerable <IEdmDirectValueAnnotation> directValueAnnotations;
            IEdmAssociation edmAssociation        = this.declaringType.Context.FindAssociation(this.navigationProperty.Relationship);
            IEdmAssociation unresolvedAssociation = edmAssociation;

            if (edmAssociation == null)
            {
                unresolvedAssociation = new UnresolvedAssociation(this.navigationProperty.Relationship, base.Location);
            }
            IEdmAssociation edmAssociation1 = unresolvedAssociation;

            this.Model.SetAssociationNamespace(this, edmAssociation1.Namespace);
            this.Model.SetAssociationName(this, edmAssociation1.Name);
            CsdlSemanticsAssociation    csdlSemanticsAssociation = edmAssociation1 as CsdlSemanticsAssociation;
            CsdlSemanticsAssociationEnd end1 = edmAssociation1.End1 as CsdlSemanticsAssociationEnd;
            CsdlSemanticsAssociationEnd end2 = edmAssociation1.End2 as CsdlSemanticsAssociationEnd;

            if (csdlSemanticsAssociation != null && end1 != null && end2 != null)
            {
                CsdlSemanticsModel model = this.Model;
                CsdlSemanticsNavigationProperty         csdlSemanticsNavigationProperty = this;
                IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations       = csdlSemanticsAssociation.DirectValueAnnotations;
                if (this.navigationProperty.FromRole == end1.Name)
                {
                    csdlSemanticsElement = end1;
                }
                else
                {
                    csdlSemanticsElement = end2;
                }
                IEnumerable <IEdmDirectValueAnnotation> directValueAnnotations1 = csdlSemanticsElement.DirectValueAnnotations;
                if (this.navigationProperty.FromRole == end1.Name)
                {
                    csdlSemanticsElement1 = end2;
                }
                else
                {
                    csdlSemanticsElement1 = end1;
                }
                IEnumerable <IEdmDirectValueAnnotation> edmDirectValueAnnotations1 = csdlSemanticsElement1.DirectValueAnnotations;
                if (edmAssociation1.ReferentialConstraint != null)
                {
                    directValueAnnotations = edmAssociation1.ReferentialConstraint.DirectValueAnnotations;
                }
                else
                {
                    directValueAnnotations = Enumerable.Empty <IEdmDirectValueAnnotation>();
                }
                model.SetAssociationAnnotations(csdlSemanticsNavigationProperty, edmDirectValueAnnotations, directValueAnnotations1, edmDirectValueAnnotations1, directValueAnnotations);
            }
            return(edmAssociation1);
        }