diff --git a/fastapi_async_sqlalchemy/middleware.py b/fastapi_async_sqlalchemy/middleware.py index 1a407fa..bb6024d 100644 --- a/fastapi_async_sqlalchemy/middleware.py +++ b/fastapi_async_sqlalchemy/middleware.py @@ -51,7 +51,7 @@ def __init__( ) async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): - async with db(commit_on_exit=self.commit_on_exit): + async with DBSession(commit_on_exit=self.commit_on_exit): return await call_next(request) class DBSessionMeta(type):