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

.NET5 Scaffold-DbContext - Lower case naming issue. #24040

Closed
cgountanis opened this issue Feb 1, 2021 · 13 comments
Closed

.NET5 Scaffold-DbContext - Lower case naming issue. #24040

cgountanis opened this issue Feb 1, 2021 · 13 comments

Comments

@cgountanis
Copy link

Table [ref].[Training] get converted to object name lower case training, really strange one here, checked the PK/FK everything is upper case T. Why would it pick just this table out of 100 tables to lower case the name "training"?

Scaffold-DbContext "Server=localhost;Database=XXX;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context Context -ContextDir Models -Force

Tried with and without "-UseDatabaseName". Same results.

Soooooo strange!

image

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

Feel free to share schema privately, and I will investigate.

@cgountanis
Copy link
Author

Here is the code that will give you the same exact results. There is really nothing to it... Appreciate the help @ErikEJ @smitpatel

Create Table
CREATE TABLE [dbo].[Training]( [ID] [int] NOT NULL PRIMARY KEY)

Then in VS > Package Manager Console run:
Scaffold-DbContext "Server=localhost;Database=TEST1;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context Context -ContextDir Models -Force

Strange only the Training table gets lower cased.
image

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

I would be surprised if that is enough to repro. What is "Training2" ?

@cgountanis
Copy link
Author

cgountanis commented Feb 2, 2021

All you need is one table named Training and the uppercase T disappears. Training2 was just a test proving that it works fine unless the word is just Training. Like I said this is very simple to reproduce and very strange result. With all due respect I put the time into giving you an example. What kind of response is, you don't think this is enough to reproduce, if you didn't try it?

@cgountanis
Copy link
Author

Just to be clear, this is the new .NET5 EF5 new release version. Worked fine in CORE 3.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

Thanks, I will give it a try. What locale is your OS?

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

It looks like a bug in the default Humanizer pluralizer, you can add -NoPluralize to work around it.

@cgountanis
Copy link
Author

It looks like a bug in the default Humanizer pluralizer, you can add -NoPluralize to work around it.

You know that was going to be my first guess since it worked in 3.0 and the plural seem to come out with five. I was going to mention something but I didn't want to just guess. Really appreciate the time and I had no clue about that flag so that will come in very handy. Since it's a bug is there anything I can do to get it on the to-do list for fixing?

@roji
Copy link
Member

roji commented Feb 2, 2021

I think we'd need to file a bug https://github.com/Humanizr/Humanizer, @ErikEJ do you want to do the honors? :)

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

Sure, I will file a bug!

@cgountanis
Copy link
Author

Thanks guys I really appreciate the help and time on this one.

@roji
Copy link
Member

roji commented Feb 2, 2021

Thanks @ErikEJ - please post the link to it here in case people land here.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

Bug report created here: Humanizr/Humanizer#1030

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants