|
Hi,
Is it possible to load information into a reference via a query / set of criterion rather than returning an object - i.e. making a call to List()?
The deal is - I have an object with a unique index as well as a primary key (user ID & username). Now I don't have the user ID until i've loaded it, so I want to be able to load via the username - the unique index.
I don't want to have something sitting ontop of my user object, so the dataaccess is performed in the class - which is why I'd like to pass in a reference:
using(ISession session = SessionManager.NewSession())
{
ICriteria nhCriteria = session.CreateCriteria(typeof(MyUserObject));
nhCriteria.Load(this, new ICriterion[] { Expression.Eq("Name", _name) });
}
or something like that - where we can supply queries / criterion to the session / criteria, and also a reference.
Can this be done?
|