hh2 is just a namespace.
query is session.Query<DatabaseFile>().Where(p => p.ID == 
hh2.InternalUser.CurrentUser.Options.GetOptionValue(206).ToInt()).Select(p 
=> p.ExternalId).FirstOrDefault()

Everything is definitely in memory and this class is from the "old" system 
and not mapped in nhibernate or anything. CurrentUser gets the object from 
the HttpContext. I'm not sure how it's happening, but ultimately the 
expression tree is getting to nhibernate and they are looking for a 
registered method, which there isn't one, but it should have been replaced 
by the value earlier i'm guessing. The only thing i'm curious about is the 
web page this is on is running .net 4.0, but the InternalUser is a 3.5 dll, 
but again it works in the old linq provider, so i'm guessing it's just not 
being detected as locally evaluatable. I also couldn't get any tests to fail 
even by recreating the structure.

What i'm going to try to do today is build nhibernate from source and attach 
a debugger and look at the expression tree, anything that might be helpful 
that i could get you fabian?

example code for InternalUser would be like this.

class InternalUser {
    public UserOptions Options { get; set; }
    public static InternalUser CurrentUser { get { return 
Cache<InternalUser>["key"]; } }
}

class UserOptions
{
    IDictionary<int,string> Settings;
    public string GetOptionSetting(int option)
    {
        return Settings[option];
    }
}

static class StringExtensions
{
    public static int ToInt(this string value) {
        return int.Parse(value);
    }
}

Reply via email to