EFUtility.CodeGenerationTools.MetadataTools.GetCorrespondingDependentProperty C# (CSharp) Method

GetCorrespondingDependentProperty() public method

Given a property on the principal end of a referential constraint, returns the corresponding property on the dependent end. Requires: The association has a referential constraint, and the specified principalProperty is one of the properties on the principal end.
public GetCorrespondingDependentProperty ( System.Data.Metadata.Edm.NavigationProperty navProperty, System.Data.Metadata.Edm.EdmProperty principalProperty ) : System.Data.Metadata.Edm.EdmProperty
navProperty System.Data.Metadata.Edm.NavigationProperty
principalProperty System.Data.Metadata.Edm.EdmProperty
return System.Data.Metadata.Edm.EdmProperty
        public EdmProperty GetCorrespondingDependentProperty(NavigationProperty navProperty, EdmProperty principalProperty)
        {
            if (navProperty == null)
            {
                throw new ArgumentNullException("navProperty");
            }

            if (principalProperty == null)
            {
                throw new ArgumentNullException("principalProperty");
            }

            ReadOnlyMetadataCollection<EdmProperty> fromProperties = GetPrincipalProperties(navProperty);
            ReadOnlyMetadataCollection<EdmProperty> toProperties = GetDependentProperties(navProperty);
            return toProperties[fromProperties.IndexOf(principalProperty)];
        }