コード例 #1
0
        private static Expression <Func <TSourceEntity, bool> > BuildWhereLambda(
            IReadOnlyList <IProperty> keyProperties, ValueBuffer keyValues)
        {
            var entityParameter = Expression.Parameter(typeof(TSourceEntity), "e");

            return(Expression.Lambda <Func <TSourceEntity, bool> >(
                       ExpressionExtensions.BuildPredicate(keyProperties, keyValues, entityParameter), entityParameter));
        }
コード例 #2
0
        private static Expression <Func <TEntity, IEnumerable <TSourceEntity> > > BuildIncludeLambda(
            ISkipNavigation skipNavigation,
            IReadOnlyList <IProperty> keyProperties,
            ValueBuffer keyValues)
        {
            var whereParameter  = Expression.Parameter(typeof(TSourceEntity), "e");
            var entityParameter = Expression.Parameter(typeof(TEntity), "e");

            return(Expression.Lambda <Func <TEntity, IEnumerable <TSourceEntity> > >(
                       Expression.Call(
                           EnumerableMethods.Where.MakeGenericMethod(typeof(TSourceEntity)),
                           Expression.MakeMemberAccess(
                               entityParameter,
                               skipNavigation.PropertyInfo),
                           Expression.Lambda <Func <TSourceEntity, bool> >(
                               ExpressionExtensions.BuildPredicate(keyProperties, keyValues, whereParameter),
                               whereParameter)), entityParameter));
        }