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(); }
public UnitOfWork(IActiveSessionManager sessionManager) { this.sessionManager = sessionManager; if (sessionManager.HasActiveSession) { isRootUnitOfWork = false; session = sessionManager.GetActiveSession(); } else { isRootUnitOfWork = true; session = sessionManager.OpenSession(); } }