Esempio n. 1
0
 internal override bool ParseSingleElement(ICollection <XName> unprocessedElements, XElement elem)
 {
     if (elem.Name.LocalName == AssociationEnd.ElementName)
     {
         var assocEnd = new AssociationEnd(this, elem);
         _ends.Add(assocEnd);
         assocEnd.Parse(unprocessedElements);
     }
     else if (elem.Name.LocalName == ReferentialConstraint.ElementName)
     {
         if (_referentialConstraint != null)
         {
             var msg = String.Format(
                 CultureInfo.CurrentCulture, Resources.TOO_MANY_REFERENTIAL_CONSTRAINTS_IN_ASSOCIATION, LocalName.Value);
             Artifact.AddParseErrorForObject(this, msg, ErrorCodes.TOO_MANY_REFERENTIAL_CONSTRAINTS_IN_ASSOCIATION);
         }
         else
         {
             _referentialConstraint = new ReferentialConstraint(this, elem);
             _referentialConstraint.Parse(unprocessedElements);
         }
     }
     else
     {
         return(base.ParseSingleElement(unprocessedElements, elem));
     }
     return(true);
 }
Esempio n. 2
0
 internal NavigationProperty FindNavigationPropertyForEnd(AssociationEnd end)
 {
     foreach (var np in _navigationProperties)
     {
         if (np.FromRole.Target == end)
         {
             return(np);
         }
     }
     return(null);
 }
Esempio n. 3
0
        /// <summary>
        ///     Gets the AssociationEnd that is not pointing to the given EntityType. This method should not be
        ///     called for self-associations.
        /// </summary>
        /// <param name="oneEnd"></param>
        /// <returns></returns>
        internal AssociationEnd GetOtherEnd(EntityType entityType)
        {
            Debug.Assert(
                !IsSelfAssociation,
                "GetOtherEnd() will not work correctly for self associations as both ends point to the same entity type");

            AssociationEnd otherEnd = null;

            if (End1.Type.Target == entityType)
            {
                otherEnd = End2;
            }
            else if (End2.Type.Target == entityType)
            {
                otherEnd = End1;
            }

            return(otherEnd);
        }
Esempio n. 4
0
 internal AssociationEnd GetOtherEnd(AssociationEnd oneEnd)
 {
     return(End1 == oneEnd ? End2 : End1);
 }
Esempio n. 5
0
 internal void AddAssociationEnd(AssociationEnd end)
 {
     _ends.Add(end);
 }