Jason Foglia
Jason Foglia

Reputation: 2541

System.Linq.Expressions.InstanceMethodCallExpressionN

I get this exception, any thoughts how to fix? I know its something stupid but can't seem to figure it out.

Expression type not supported:

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

Upvotes: 0

Views: 884

Answers (1)

SLaks
SLaks

Reputation: 887459

Don't dispose the session before using the query.

Upvotes: 3

Related Questions