コード例 #1
0
        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());
        }
コード例 #2
0
ファイル: Pipelines.cs プロジェクト: naimeshpatel/Crux
        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;
            });
        }
コード例 #3
0
 public ITransactionalUnitOfWorkScope CreateTransactionalScope(UnitOfWorkTransactionOptions options)
 {
     return(new TransactionalUnitOfWorkScope(this, new NHibernateUnitOfWorkTransaction(this, options)));
 }
コード例 #4
0
 public ITransactionalUnitOfWorkScope CreateTransactionalScope()
 {
     return(CreateTransactionalScope(UnitOfWorkTransactionOptions.Default()));
 }
コード例 #5
0
 public NHibernateUnitOfWorkTransaction(INHibernateUnitOfWork unitOfWork, UnitOfWorkTransactionOptions options)
 {
     _unitOfWork = unitOfWork;
     _options    = options;
 }
コード例 #6
0
 public void Begin()
 {
     _scope = _unitOfWork.CreateTransactionalScope(UnitOfWorkTransactionOptions.Default());
 }
コード例 #7
0
 protected UnitOfWorkMessageHandler(UnitOfWorkTransactionOptions options)
 {
     _options = options;
     _log     = LogManager.GetLogger(GetType());
 }
コード例 #8
0
 protected UnitOfWorkMessageHandler()
     : this(UnitOfWorkTransactionOptions.Default())
 {
 }