/* ColumnsClip<T> columnsClip = new ColumnsClip<T>(Expression.Lambda<Func<T, T>>(Expression.Call(null, (MethodInfo)methodof(ExpressionExt.Columns), new Expression[] { expression = Expression.Parameter(typeof(T), "t"), Expression.NewArrayInit(typeof(object), new Expression[] { Expression.Convert(Expression.Call(null, (MethodInfo)methodof(ExpressionExt.As), new Expression[] { Expression.Call(null, (MethodInfo)methodof(ExpressionExt.CountAll), new Expression[] { Expression.Convert(expression, typeof(IEntity)) }), Expression.Constant("TotalCount", typeof(string)) }), typeof(object)) }) }), new ParameterExpression[] { expression })); */ int num = 0; var columnsClip = new ColumnsClip<T>((t) => t.Columns(t.CountAll().As("TotalCount")));
注释的原始的linq.
下面的是我写的转化的. 不过好像不多. 请大牛帮指点一下..