Create fresh NpgsqlConnection per tenant iteration instead of reusing EF Core's managed connection. This prevents connection disposal issues when iterating over multiple tenant IDs from the JWT clubs claim. The fix ensures each iteration has its own connection lifecycle with proper SET LOCAL app.current_tenant_id for RLS compliance.
4.7 KiB
4.7 KiB