0

我得到了这个异常,有什么想法可以解决吗?我知道它很愚蠢,但似乎无法弄清楚。

不支持表达式类型:

System.Linq.Expressions.InstanceMethodCallExpressionN

public static IQueryable<T> GetBy<T>(Expression<Func<T, bool>> predicate)
    {
        try
        {
            IDocumentSession RavenSession = MvcApplication.Store.OpenSession();
            var t = RavenSession.Query<T>().Where(predicate);
            RavenSession.Dispose();
            //return t.AsQueryable<T>();
            return t;
        }
        catch (Exception e)
        {
            throw e;
        }
    }

var r = DB.GetBy<Docs>(x => x.Id == Id).FirstOrDefault(); <-- this is where I get the exception
4

1 回答 1

3

在使用查询之前不要释放会话。

于 2012-05-07T18:53:40.403 回答