I see so many NHibernate code examples which start with "session.". But in
my work project, based on NHibernate 2.2 (I think), uses no such syntax.
Here's where I play with sample query fragments, in the QueryOver()
function:
public override IQueryOver<VehicleListing, VehicleListing>
QueryOver(IQueryOver<VehicleListing, VehicleListing> query)
{
return base.QueryOver(query).
Where(x => x.DealerId == DealerId);
}
Here is an example fragment.
RegisterFragment(CONSUMER_BY_USED_CARS_FIRST, x => x.OrderBy(
Projections.Conditional(
Restrictions.Where<VehicleListing>(v =>
v.Manufacturer == "My Brand"),
Projections.Constant(0),
Projections.Constant(1))).Asc.
ThenBy(y => y.Condition).Desc.
ThenBy(y => y.Id).Asc);
What am I missing?
I can not test sample code, lil the following:
Forest f = null;Tree t = null;
ForestsFound = session.QueryOver<Forest>(() => f)
.JoinAlias(() => t.Forest, () => f)
.Where(() => t.NumberOfTrees > 1000)
.List<Forest>()
.ToList<Forest>();
How do I connect these "two worlds" so I can use code from the web?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.