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

Fix table casing to be the expected default (Pascal casing) #24819

Merged
merged 2 commits into from
Jun 29, 2021

Conversation

lauxjpn
Copy link
Contributor

@lauxjpn lauxjpn commented May 1, 2021

For databases with case sensitive object names, the object name casing in FromSqlRaw() calls should be the expected default one, which is Pascal casing.

@@ -22,7 +22,7 @@ protected ConcurrencyDetectorDisabledRelationalTestBase(TFixture fixture)
[MemberData(nameof(IsAsyncData))]
public virtual Task FromSql(bool async)
=> ConcurrencyDetectorTest(async c => async
? await c.Products.FromSqlRaw("select * from products").ToListAsync()
: c.Products.FromSqlRaw("select * from products").ToList());
? await c.Products.FromSqlRaw("select * from Products").ToListAsync()
Copy link
Member

Choose a reason for hiding this comment

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

To do this really properly, it should go through NormalizeDelimitersInRawString just like in #24806; PostgreSQL requires the identifier to be double-quoted here because it contains uppercase characters.

Ideally we'd have one place in a provider's test code where NormalizeDelimitersInRawString is defined (maybe in the TestHelpers implementation?), what do you think @maumar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I implement this or are we still waiting on @maumar?

Copy link
Contributor

Choose a reason for hiding this comment

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

To unblock this PR, just define/use the method like this

protected string NormalizeDelimitersInRawString(string sql)
=> Fixture.TestStore.NormalizeDelimitersInRawString(sql);

Currently the method is defined on test store so that providers can change it as needed at the same time it is pretty DRY too. We can re-discuss later in MQ if we want to make "more" DRY.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, fixed it as simply as possible. The more proper implementation would need to split the inheritance hierarchy at some point to distinguish between relational and non-relational base implementations, and would also rename a couple of classes.

@smitpatel smitpatel merged commit 2dd8f76 into dotnet:main Jun 29, 2021
@smitpatel
Copy link
Contributor

@lauxjpn - Thank you.

@lauxjpn lauxjpn deleted the fix/concurrency_detector_casing branch June 29, 2021 19:04
lauxjpn added a commit to lauxjpn/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Nov 9, 2021
lauxjpn added a commit to lauxjpn/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Nov 9, 2021
lauxjpn added a commit to PomeloFoundation/Pomelo.EntityFrameworkCore.MySql that referenced this pull request Nov 9, 2021
* Remove remnants of workaround for dotnet/efcore#25127.

* Remove workaround for dotnet/efcore#24819.

* Remove workaround for dotnet/efcore#24806.

* Remove workaround for dotnet/efcore#19027.
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.

4 participants