SqlServer-事务

事务支持

基本用法:

using (MsSqlContext context = new MsSqlContext(DbHelper.ConnectionString))
{
    context.Session.BeginTransaction();
    try
    {
        /* do some things here */
        context.Update(user);
        context.Delete<User>(a => a.Gender == null);

        context.Session.CommitTransaction();
    }
    catch
    {
        if (context.Session.IsInTransaction)
            context.Session.RollbackTransaction();
        throw;
    }
}