You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Disposing QueryFactory dispose also my connection #650
From my perspective, QueryFactory should not be responsible for opening/closing/disposing the underlying IDbConnection - especially when the connection is shared and managed outside of SqlKata (e.g., reused in further processing).
At minimum, it would be great to have an opt-out / configuration flag to prevent disposal of the provided connection, similar in spirit to StreamReader(..., leaveOpen: true).
That way:
SqlKata can still optionally manage a connection lifecycle for users who want it, but
callers who own the connection can retain full control and avoid unintended disposal.
Activity
Cricle commentedon Jan 1, 2023
I think it can't removed. Because the QueryFactory responsibilities include the management of database connection.(:
oe-andreas-soroko commentedon Feb 25, 2026
I ran into the same behavior as well.
From my perspective,
QueryFactoryshould not be responsible for opening/closing/disposing the underlyingIDbConnection- especially when the connection is shared and managed outside of SqlKata (e.g., reused in further processing).At minimum, it would be great to have an opt-out / configuration flag to prevent disposal of the provided connection, similar in spirit to
StreamReader(..., leaveOpen: true).That way: