"A IStatelessSession has no persistence context associated with it and does not provide many of the higher-level life cycle semantics. In particular, a stateless session does not implement a first-level cache nor interact with any second-level or query cache. It does not implement transactional write-behind or automatic dirty checking."
using (IStatelessSession statelessSession = sessionFactoryHelper.OpenStatelessSession())
{
  using (ITransaction transaction = statelessSession.BeginTransaction())
  {
    try
    {
      statelessSession.Insert(objEntity);
      transaction.Commit();
      return objEntity;
    }
    catch (Exception ex)
    {
      transaction.Rollback();
      throw ex;
    }
  }
}
 
No comments:
Post a Comment