I have a simple class like this
[ActiveRecord("Subscriptions")]
public class Subscription : ActiveRecordBase<Subscription>
{
public Subscription()
{
}
public Subscription(string name)
{
this.Name = name;
}
[PrimaryKey(PrimaryKeyType.Native)]
private int Id { get; set; }
[Property]
public string Name { get; set; }
}
And I want to do a simple lookup using the FindOne() method that's inheritd from the base class. It looks like it uses NHibernate.Criterion.DetachedCriteria but I can't find any examples.
it isn't very complex:
Subscription.FindOne(NHibernate.Criterion.Expression.Eq("Id",3))
With the Expression-class you have all the things you need to build your sql/hql/select, you just have to nest it again and again.
Subscription.FindOne(Expression.And(Expression.Eq(...),Expression.Eq(...)))
Greetings Juy Juka