src/Misc/EFTools/EntityDesignDatabaseGeneration/MetadataWorkspaceExtensions.cs
/// <summary>
///     If this is a property that participates in the principal end of a referential constraint, this method will return
///     the corresponding property on the dependent end.
/// </summary>
/// <example>
///     <ReferentialConstraint>
///         <Principal Role="DiscontinuedProduct">
///             <PropertyRef Name="ProductId" />
///             <PropertyRef Name="ProductName" />
///         </Principal>
///         <Dependent Role="DiscontinuedItem">
///             <PropertyRef Name="ItemId" />
///             <PropertyRef Name="ItemName" />
///         </Dependent>
///     </ReferentialConstraint>
///     In this example, if 'ProductName' were passed into this method, 'ItemName' would be returned.
/// </example>
/// <param name="property">The property on the principal end of the referential constraint</param>
/// <param name="refConstraint">The referential constraint.</param>
/// <returns>The property on the dependent end of the referentail constraint corresponding to the property on the principal end</returns>
/// <exception cref="ArgumentNullException">if the ref constraint is null</exception>
/// <exception cref="InvalidOperationException">if the property cannot be found among the properties on the principal end of the referential constraint</exception>
If this is a property that participates in the principal end of a referential constraint, this method will return
the corresponding property on the dependent end.
If this is a property that participates in the principal end of a referential constraint this method will return the corresponding property on the dependent end .
public static EdmProperty GetDependentProperty(this EdmProperty property, ReferentialConstraint refConstraint)
        {
            if (refConstraint == null)
            {
                throw new ArgumentNullException("refConstraint");
            }
            var indexInFromProperties = refConstraint.FromProperties.IndexOf(property);
            if (indexInFromProperties == -1)
            {
                throw new InvalidOperationException(
                    String.Format(
                        CultureInfo.CurrentCulture, Resources.ErrorNoPropertyInRefConstraint, property.Name, refConstraint.FromRole.Name,
                        refConstraint.ToRole.Name));
            }
            return refConstraint.ToProperties.ElementAt(indexInFromProperties);
        }
public static EdmProperty GetDependentProperty ( this EdmProperty property , ReferentialConstraint refConstraint ) { if ( refConstraint == null ) { throw new ArgumentNullException ( " " ) ; } var indexInFromProperties = refConstraint . FromProperties . IndexOf ( property ) ; if ( indexInFromProperties == - 1 ) { throw new InvalidOperationException ( String . Format ( CultureInfo . CurrentCulture , Resources . ErrorNoPropertyInRefConstraint , property . Name , refConstraint . FromRole . Name , refConstraint . ToRole . Name ) ) ; } return refConstraint . ToProperties . ElementAt ( indexInFromProperties ) ; }
If this is a property that participates in the principal end of a referential constraint, this method will return
the corresponding property on the dependent end.
If this is a property that participates in the principal end of a referential constraint this method will return the corresponding property on the dependent end .
The property on the dependent end of the referentail constraint corresponding to the property on the principal end
The property on the dependent end of the referentail constraint corresponding to the property on the principal end
if the ref constraint is null
if the ref constraint is null
if the property cannot be found among the properties on the principal end of the referential constraint
if the property cannot be found among the properties on the principal end of the referential constraint
EdmProperty
this
refConstraint
ReferentialConstraint
The referential constraint.
The referential constraint .
property
The property on the principal end of the referential constraint
The property on the principal end of the referential constraint
example
In this example, if 'ProductName' were passed into this method, 'ItemName' would be returned.
In this example if ' ProductName ' were passed into this method ' ItemName ' would be returned .