/// <summary> /// See whether the ReferentialConstraintIdentity otherRci contains a "covering" for this /// i.e. for each AssociationPropertyIdentity in this._propertyIdentities see whether /// otherRci._propertyIdentities contains a principal->dependent mapping which has /// at least the same principal DatabaseColumns (but possibly more) _and_ at least /// the same dependent DatabaseColumns (but possibly more). /// This allows for treating these ReferentialConstraintIdentity's as identical for the purposes /// of Update Model even if a given C-side property has been mapped to more than 1 S-side property. /// </summary> internal bool IsCoveredBy(ReferentialConstraintIdentity otherRci) { foreach (var thisApi in _propertyIdentities) { var foundCoveringApi = false; if (null != otherRci) { foreach (var otherApi in otherRci._propertyIdentities) { if (thisApi.IsCoveredBy(otherApi)) { // have found an AssociationPropertyIdentity in other._propertyIdentities which covers thisApi foundCoveringApi = true; break; } } } if (false == foundCoveringApi) { // no covering AssociationPropertyIdentity was found for thisApi in // other._propertyIdentities return(false); } } // all AssociationPropertyIdentity's in this._propertyIdentities were covered by // AssociationPropertyIdentity's in otherRci._propertyIdentities return(true); }
internal static ReferentialConstraintIdentity CreateReferentialConstraintIdentity(ReferentialConstraint referentialConstraint) { if (referentialConstraint == null) { Debug.Fail("null referential constraint"); } else { var rcid = new ReferentialConstraintIdentity(); rcid._propertyIdentities = AssociationPropertyIdentity.CreateIdentitiesFromReferentialConstraint(referentialConstraint); return(rcid); } return(null); }
private AssociationIdentityForReferentialConstraint(ReferentialConstraint rc) { _referentialConstraintIdentity = ReferentialConstraintIdentity.CreateReferentialConstraintIdentity(rc); }