OK, slightly complicated lead-up to this question. I have location
data in my DB, which for performance reasons is split into different
tables, according to the country it's in. I've set up my NH classes
like so:
public abstract class Location
{
public virtual int LocationID { get; set; }
// etc, etc.
}
public class Location_UK {}
So far so good. I used Fluent NHibernate to then map these classes to
tables. It all works great, except that now I want to use QueryOver()
and I'm not sure how I can achieve it. Right now, I can only do:
if (country == "UK") {
from l in ISession.QueryOver<Location_UK>() where // etc
} else if (country == "FR") {
from l in ISession.QueryOver<Location_FR>() where // etc
}
duplicating my where clauses every single time- which is tedious. I'd
love to be able to something like:
from l in ISession.QueryOver<Location>("UK") where // etc
or even
from l in GetLocationQueryOver("UK",ISession) where //etc
but I can't see how I'd go about doing that. It won't let me cast
between the abstract types. Does anyone have any ideas?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.