-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ConfigureDataSource() to NpgsqlDbContextOptionsBuilder #3277
Conversation
1bb28cb
to
aaae63a
Compare
aaae63a
to
d358126
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
} | ||
|
||
[Fact] | ||
public void Data_source_config_with_same_connection_string_and_different_lambda() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very helpful test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right 🤣 More like documentation to remind future self what's going on...
@@ -18,6 +18,13 @@ public NpgsqlDbContextOptionsBuilder(DbContextOptionsBuilder optionsBuilder) | |||
{ | |||
} | |||
|
|||
/// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we want a remark on the semantics here? Something in the direction of: "Changes made by ConfigureDataSource are untracked. For OnConfiguring identical configuration through other methods on NpgsqlDbContextOptionsBuilder will cause EF Core to resolve the same DbDataSource, even when ConfigureDataSource changes in future calls of OnConfiguring. When referencing outside state in ConfigureDataSource keep it static or ensure it also causes changes to other NpgsqlDbContextOptionsBuilder configuration."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Twaked the message a bit, but otherwise same idea.
d358126
to
cee54a8
Compare
@NinoFloris also pushed a check to throw when both an (external) NpgsqlDataSource is passed to UseNpgsql() and the data source config lambda is defined. |
@roji will this be available in 8.x.x? |
No, this is a significant, complex change, and as the milestone on the issues linked the PR show, it's for 9.0. |
Got it. Thanks for the explanation. |
Closes #2542
Closes #2704
/cc @NinoFloris