http://sourceforge.net/projects/nhibernate/
How to use ICriteria ?
ICriteria criteria = SessionManager.CurrentSession.CreateCriteria
criteria = criteria.Add(NHibernate.Criterion.Expression.Eq("StudentId", 48));
Student stu= criteria.UniqueResult
How to Map two or more database table from one object in nhibernate ?
Suppose thhe following school object does not have a property called Student ,
public class School
{
public virtual ISet
}
Now in hbm you can map like
< set name="Students" table="Students" schema="oneSchool" cascade="all-delete-orphan" lazy="true" where ="AdminDate() between StartDate And IsNull(EndDate,GetDate())">
< key column="SchooldId" / >
< many-to-many class="Student" column="StudentId"/ >
< /set>
how to use transaction in Nhibernate ?
use Nhibernate.Transaction namespace reference;
using (ITransaction tran = SessionManager.CurrentSession.BeginTransaction())
{
tran.commit();
}
No comments:
Post a Comment