-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 sugar for determining the database provider in use #8545
Conversation
[Fact] | ||
public void IsSqlServer_in_OnModelCreating_when_using_OnConfguring() | ||
{ | ||
using (new SqlServerOnModelContext()) |
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.
?
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.
There are asserts in the context below. But I will add some more code that checks that the asserts actually get hit.
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.
/// </summary> | ||
public virtual string ProviderName | ||
=> _context.GetService<IEnumerable<IDatabaseProvider>>() | ||
?.Select(p => p.InvariantName) |
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.
Can GetService<IEnumerable>()
return null
?
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.
It's never been very clear in the spec--it may depend on the D.I. container being used.
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.
Ah, good point.
We should add matching sugar to MigrationBuilder. (filed #8566) |
0149329
to
efca279
Compare
Part of #7166 Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.
efca279
to
b9cd36d
Compare
Am I understanding correctly that this won't be merged for 2.0.0? Would it be possible to specify the milestone so it's easier to understand when you guys are planning to release things? |
@roji Or are you asking about this PR specifically? If so, then the issue is in a milestone. We put issues in milestones rather than PRs. |
@ajcvickers oh ok, thanks :) Will try to get it in for Npgsql's 2.0.0 release too then! |
Part of #7166
Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.