private void AddRootPropertyDetails(IncludeSecurityExpressionBuilder includeMetadata, Type typeUnderQuery, ParameterExpression parameterForTypeUnderQuery, string propertyPathSegment)
        {
            var currentProperty        = typeUnderQuery.GetProperty(propertyPathSegment);
            var propertyAccessMetadata = new IncludePathMetadataFragment(typeUnderQuery, currentProperty.PropertyType, Expression.MakeMemberAccess(parameterForTypeUnderQuery, currentProperty));

            includeMetadata.IncludedPropertyDetails.Add(propertyAccessMetadata);
        }
 private void AddNestedPropertyDetails(IncludeSecurityExpressionBuilder includeMetadata, string propertyPathSegment, IncludePathMetadataFragment previousIncludePathMetadataFragment)
 {
     var currentProperty = previousIncludePathMetadataFragment.PropertySingularType.GetProperty(propertyPathSegment);
     var parameterExpression = Expression.Parameter(previousIncludePathMetadataFragment.PropertySingularType);
     var propertyAccessMetadata = new IncludePathMetadataFragment(previousIncludePathMetadataFragment.PropertySingularType, currentProperty.PropertyType, Expression.MakeMemberAccess(parameterExpression, currentProperty));
     includeMetadata.IncludedPropertyDetails.Add(propertyAccessMetadata);
 }
        private void AddNestedPropertyDetails(IncludeSecurityExpressionBuilder includeMetadata, string propertyPathSegment, IncludePathMetadataFragment previousIncludePathMetadataFragment)
        {
            var currentProperty        = previousIncludePathMetadataFragment.PropertySingularType.GetProperty(propertyPathSegment);
            var parameterExpression    = Expression.Parameter(previousIncludePathMetadataFragment.PropertySingularType);
            var propertyAccessMetadata = new IncludePathMetadataFragment(previousIncludePathMetadataFragment.PropertySingularType, currentProperty.PropertyType, Expression.MakeMemberAccess(parameterExpression, currentProperty));

            includeMetadata.IncludedPropertyDetails.Add(propertyAccessMetadata);
        }
        private LambdaExpression GetLambdaForSimpleProperty <T>(IncludePathMetadataFragment includePathMetadataFragment, LambdaExpression filterLambda)
        {
            var lambdaType     = typeof(Func <,>).GetGenericTypeDefinition().MakeGenericType(includePathMetadataFragment.DeclaringType, includePathMetadataFragment.PropertyType);
            var rootParameter  = Expression.Parameter(includePathMetadataFragment.DeclaringType);
            var propertyLambda = Expression.Lambda(lambdaType, includePathMetadataFragment.PropertyAccessExpression, rootParameter);

            return(ParameterToMemberExpressionRebinder.CombineSinglePropertySelectorWithPredicate(propertyLambda, filterLambda));
        }
        private LambdaExpression GetLambdaForEnumerableProperty <T>(IncludePathMetadataFragment includePathMetadataFragment, LambdaExpression filterLambda)
        {
            var lambdaType      = typeof(Func <,>).GetGenericTypeDefinition().MakeGenericType(includePathMetadataFragment.DeclaringType, includePathMetadataFragment.PropertyType);
            var memberParameter = (ParameterExpression)includePathMetadataFragment.PropertyAccessExpression.Expression;
            var propertyLambda  = Expression.Lambda(lambdaType, includePathMetadataFragment.PropertyAccessExpression, memberParameter);

            return(SecurityExtensions.CombineCollectionPropertySelectorWithPredicate(propertyLambda, filterLambda));
        }
 private void AddRootPropertyDetails(IncludeSecurityExpressionBuilder includeMetadata, Type typeUnderQuery, ParameterExpression parameterForTypeUnderQuery, string propertyPathSegment)
 {
     var currentProperty = typeUnderQuery.GetProperty(propertyPathSegment);
     var propertyAccessMetadata = new IncludePathMetadataFragment(typeUnderQuery, currentProperty.PropertyType, Expression.MakeMemberAccess(parameterForTypeUnderQuery, currentProperty));
     includeMetadata.IncludedPropertyDetails.Add(propertyAccessMetadata);
 }