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
Allow passing a NpgsqlDataSource to the constructor of the generated queries class #458
Thanks, glad it's useful! Yes, I'd like to support this.
It's needed for MapComposite/plugins and for sharing one pool. Your approach looks right, especially not disposing a data source the caller passed in. A PR would be welcome. A few things:
Keep the existing connection-string and transaction constructors working as they do now.
Please make sure it compiles for both net8.0 and netstandard2.0 (nullable handling differs).
Add or update a test that builds the class from an NpgsqlDataSource and checks that Dispose() leaves it usable.
Regenerate the examples (make sqlc-generate-process).
MySQL has the same data-source pattern. Feel free to include it, or I'll open a follow-up. 🎉
@greg-blackcurrent Great! make sure to pull from main, I did some long awaited changes :)
nothing there should stop you form what you are doing, I'll wait for your PR for the next release 🥇
Activity
doron050 commentedon Oct 22, 2026
Thanks, glad it's useful! Yes, I'd like to support this.
It's needed for MapComposite/plugins and for sharing one pool. Your approach looks right, especially not disposing a data source the caller passed in. A PR would be welcome. A few things:
MySQL has the same data-source pattern. Feel free to include it, or I'll open a follow-up. 🎉
greg-blackcurrent commentedon Oct 22, 2026
Great!
I'll see if I can squeeze this (and #459 #460) into my next sprint.
doron050 commentedon Oct 24, 2026
@greg-blackcurrent Great! make sure to pull from main, I did some long awaited changes :)
nothing there should stop you form what you are doing, I'll wait for your PR for the next release 🥇