Skip to content
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

Merged
merged 1 commit into from
May 24, 2017

Conversation

ajcvickers
Copy link
Member

Part of #7166

Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.

[Fact]
public void IsSqlServer_in_OnModelCreating_when_using_OnConfguring()
{
using (new SqlServerOnModelContext())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

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.

Copy link
Contributor

@bricelam bricelam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

/// </summary>
public virtual string ProviderName
=> _context.GetService<IEnumerable<IDatabaseProvider>>()
?.Select(p => p.InvariantName)
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point.

@bricelam
Copy link
Contributor

We should add matching sugar to MigrationBuilder. (filed #8566)

Part of #7166

Main scenario here is conditional behavior in OnModelCreating now that we build a different model per provider.
@roji
Copy link
Member

roji commented May 24, 2017

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?

@ajcvickers
Copy link
Member Author

@roji It probably will be, it's just that @bricelam created the issue and completed the work before we had a chance to triage it and put it in a milestone. He's that good. 😉

@ajcvickers
Copy link
Member Author

@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.

@roji
Copy link
Member

roji commented May 24, 2017

@ajcvickers oh ok, thanks :) Will try to get it in for Npgsql's 2.0.0 release too then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants