private static UnitOfWorkTransactionOptions GetUnitOfWorkOptions(NancyContext ctx) { object val; if (!ctx.Items.TryGetValue(UNIT_OF_WORK_OPTIONS, out val)) { return(UnitOfWorkTransactionOptions.Default()); } return(val as UnitOfWorkTransactionOptions ?? UnitOfWorkTransactionOptions.Default()); }
public static Func <NancyContext, Response> BeforeEveryRequest(IContainer requestContainer) { return(ctx => { var unitOfWork = requestContainer.GetInstance <INHibernateUnitOfWork>(); var scope = unitOfWork.CreateTransactionalScope(UnitOfWorkTransactionOptions.DirtyReads()); var session = unitOfWork.CurrentSession; ctx.Items.Add(REQUEST_TRANSACTIONAL_SCOPE_KEY, scope); CurrentSessionContext.Bind(session); session.BeginTransaction(); return ctx.Response; }); }
public ITransactionalUnitOfWorkScope CreateTransactionalScope(UnitOfWorkTransactionOptions options) { return(new TransactionalUnitOfWorkScope(this, new NHibernateUnitOfWorkTransaction(this, options))); }
public ITransactionalUnitOfWorkScope CreateTransactionalScope() { return(CreateTransactionalScope(UnitOfWorkTransactionOptions.Default())); }
public NHibernateUnitOfWorkTransaction(INHibernateUnitOfWork unitOfWork, UnitOfWorkTransactionOptions options) { _unitOfWork = unitOfWork; _options = options; }
public void Begin() { _scope = _unitOfWork.CreateTransactionalScope(UnitOfWorkTransactionOptions.Default()); }
protected UnitOfWorkMessageHandler(UnitOfWorkTransactionOptions options) { _options = options; _log = LogManager.GetLogger(GetType()); }
protected UnitOfWorkMessageHandler() : this(UnitOfWorkTransactionOptions.Default()) { }