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

Default to using Humanizer.Core as reverse engineeer pluralizer #20577

Merged
merged 2 commits into from
Jun 16, 2020

Conversation

ErikEJ
Copy link
Contributor

@ErikEJ ErikEJ commented Apr 9, 2020

Fix test localization bug

fixes #11160

@ErikEJ ErikEJ requested a review from dougbu as a code owner April 9, 2020 13:00
@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 9, 2020

How do I investigate the test failures? (all tests passed on my Windows machine)

@smitpatel
Copy link
Member

Seems like intermittent issue. I restarted runs.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 10, 2020

@smitpatel Thanks, tests still fail - how do I as a contributor view the logs?

@smitpatel
Copy link
Member

  • Click on details beside failed build. (takes you to github checks page)
  • Click on "View more details on Azure Pipelines" at the end of the page.
    That will take you to azure pipeline builds. You can click on build number to reach the build page for particular PR. There there is "Tests" tab to see test results. Also click on published will give you build artifacts, (logs generated)

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 11, 2020

@smitpatel Thanks a lot "You can click on build number to reach the build page for particular PR. " was the missing link! The "View more details" link was too deep 😄

@@ -26,6 +26,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="$(HumanizerCorePackageVersion)" />
Copy link
Member

Choose a reason for hiding this comment

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

@dotnet/efcore We should discuss whether or not we want to take a direct dependency here.

Copy link
Member

Choose a reason for hiding this comment

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

may be privateassets all would solve our concerns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe, tried that, but then the tests failed

Copy link
Member

Choose a reason for hiding this comment

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

Because the dependency wouldn't flow into test project either. To clear up confusion, if you use privateassets all and use the tool in user application, does it pluralize/singularize correctly? We can hack our way for tests if functionality for user works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have no idea how to test that, but if someone can tell me how, I can give it a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smitpatel Sorry, I cannot figure out how to do that - can you provide more detailed steps.
I try to run from with VS with F5, and set the following debug parameters in project properties/Debug:
dbcontext scaffold "Data Source=(localdb)\mssqllocaldb;Intital Catalog=Northwind;Integrated Security=true" Microsoft.EntityFrameworkCore.SqlServer -o C:\temp\test\ef

But get: Missing required option '--assembly'.

I can run: dbcontext scaffold --help and get a useful help message

Copy link
Member

Choose a reason for hiding this comment

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

I have done such testing on command line only. No trust for VS. Alternatively, you should be able to build package with these changes and use the custom build package in a sample app to install EFCore.Tools and use PMC commands to test out in VS.
I will investigate on Monday.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wish there was a simple way to do this, that sounds exceedingly complicated @bricelam ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not important for me to test in VS, but the command line throws same error!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: I added "privateAssets all" and added an explicit reference from the Desing.Test project - that worked.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented Apr 19, 2020

How do I integration test this?

@smitpatel
Copy link
Member

@ErikEJ - You can add integration tests in CSharpEntityTypeGeneratorTest.

@ajcvickers
Copy link
Member

@bricelam I'm pretty sure we decided that it was okay to have pluralization on by default for reverse engineering, right? That is, we won't consider it a breaking change if the pluralization gets updated and we then start scaffolding with different names.

@ajcvickers
Copy link
Member

@Pilchie We want to bring in https://www.nuget.org/packages/Humanizer.Core/ as a third-party dependency for Microsoft.EntityFrameworkCore.Design. What steps do we need to take?

@bricelam
Copy link
Contributor

bricelam commented Apr 24, 2020

We decided that it was okay to have pluralization on by default for reverse engineering, right?

Let's discuss in a design meeting. I feel like it's ok so long as we have an option (e.g. --no-pluralize) to go back to previous behavior.

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.

Looking good! Sounds like we have a couple things to discuss in the next design meeting.

src/EFCore.Design/EFCore.Design.csproj Outdated Show resolved Hide resolved
test/EFCore.Design.Tests/EFCore.Design.Tests.csproj Outdated Show resolved Hide resolved
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.

Changes look good.

Things to discuss as a team:

  • Should we remove NullPluralizer
  • Should we pluralize by default?
    • If so, do we need an option to disable pluralization?

@bricelam
Copy link
Contributor

bricelam commented May 13, 2020

Discussed as a team. Decisions:

  • We should continue pluralizing by default
  • Need to add --no-pluralize option
    • Let's do this before merging so we don't disrupt daily builds or previews
    • We can remove NullPluralizer since --no-pluralize will have the same behavior

Other follow-up questions:

  • Is Humanizer culture sensitive?
    • If so, will users want an option to specify the culture? (But YAGNI for now)

@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 14, 2020

--no-pluralize option

Any proposal for implementation? How would you pass that all the way through - to the Pluralizer?

Let's do this before merging so we don't disrupt daily builds or previews

How would that prevent disruption, since pluralization is now on by default, and disabling it is an opt-in?

@ajcvickers
Copy link
Member

@ErikEJ We just want to avoid having people not be able to use the preview because they can't switch the behavior back to the way they want it without messing with services.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 14, 2020

Makes sense. How do you propose floating the option? How to implement "opt out" ?

@ajcvickers
Copy link
Member

@ErikEJ No idea. :-) I'd have to read the code. @bricelam might have ideas already.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 14, 2020

Fine, will await some proposals from @bricelam

@bricelam
Copy link
Contributor

Updated:

  • Rebased on master and squashed
  • Implemented --no-pluralize.

@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 15, 2020

@bricelam Thanks, Neo!

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

Successfully merging this pull request may close these issues.

Consider using Humanizer
5 participants