public static IDictionary <PropertyInfo, PropertyInfo> GetSelectedProperty(Expression exp)
        {
            PropertyPairSelectorVisitor visitor = new PropertyPairSelectorVisitor();

            visitor.Visit(exp);
            return(visitor.Properties);
        }
        public NavigationPropertyConfiguration HasRequired <TTargetEntity>(
            Expression <Func <TStructuralType, TTargetEntity> > navigationPropertyExpression,
            Expression <Func <TStructuralType, TTargetEntity, bool> > referentialConstraintExpression) where TTargetEntity : class
        {
            NavigationPropertyConfiguration navigation =
                GetOrCreateNavigationProperty(navigationPropertyExpression, EdmMultiplicity.One);

            IDictionary <PropertyInfo, PropertyInfo> referentialConstraints =
                PropertyPairSelectorVisitor.GetSelectedProperty(referentialConstraintExpression);

            foreach (KeyValuePair <PropertyInfo, PropertyInfo> constraint in referentialConstraints)
            {
                navigation.HasConstraint(constraint);
            }

            return(navigation);
        }