public virtual void DeletePerson(int id)
{
using(ISession session = OpenSession())
{
ITransaction tx = null;
try
{
tx = session.BeginTransaction();
session.Delete(string.Format("from PersonInfo where ID={0}", id));//其中PersonInfo对应的是一Model
session.Delete(string.Format("from PersonEducationalHistoryInfo where PersonID={0}", id));
session.Delete(string.Format("from PersonProfessionalHistoryInfo where PersonID={0}", id));
session.Delete(string.Format("from PersonFamilyMemberInfo where PersonID={0}", id));
tx.Commit();
}
catch(Exception ex)
{
if(tx!=null)
tx.Rollback();
throw ex;
}
}
}