コード例 #1
0
        public override void OnBeforeExecute(IRequestContext requestContext, T request)
        {
            // Called just before any Action is executed
            var session           = _sessionManager.OpenSession();
            var isReadonlyRequest = typeof(T).BaseType == typeof(ReadonlyRequest);

            if (!requestContext.EndpointAttributes.HasFlag(EndpointAttributes.HttpGet) &&
                !isReadonlyRequest)
            {
                session.FlushMode = FlushMode.Auto;
            }
            _sessionManager.BeginTransaction();
        }
コード例 #2
0
ファイル: UnitOfWork.cs プロジェクト: StefanAniff/hb.trex
        public UnitOfWork(IActiveSessionManager sessionManager)
        {
            this.sessionManager = sessionManager;

            if (sessionManager.HasActiveSession)
            {
                isRootUnitOfWork = false;
                session          = sessionManager.GetActiveSession();
            }
            else
            {
                isRootUnitOfWork = true;
                session          = sessionManager.OpenSession();
            }
        }