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

Stop using AddFromFile with many files #24937

Merged
merged 2 commits into from
Jun 7, 2021
Merged

Conversation

ErikEJ
Copy link
Contributor

@ErikEJ ErikEJ commented May 19, 2021

("really slow" on SDK style .csproj)

fixes #24933

("really slow" on SDK style .csproj)
@AndriySvyryd
Copy link
Member

@bricelam Do you think we'll need to add a note in the docs for non-SDK projects to add the files manually?

@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 20, 2021

EF Core 6 will only support .net 5/6 - but this file is global, and also works for 3.1??

@bricelam
Copy link
Contributor

bricelam commented May 20, 2021

We already skip calling ProjectItem.Remove() when it's not needed (for different reasons), so I just intended to copy that code:

if (!(IsCpsProject $dteProject) -or (GetCpsProperty $dteProject 'EnableDefaultItems') -ne 'true' -or (GetCpsProperty $dteProject 'EnableDefaultCompileItems') -ne 'true')
{
$files = $result.migrationFile, $result.metadataFile, $result.snapshotFile
$files | ?{ $_ -ne $null } | %{
$projectItem = GetProjectItem $dteProject $_
if ($projectItem)
{
$projectItem.Remove()

@bricelam
Copy link
Contributor

We might as well do it for Add-Migration too

@bricelam
Copy link
Contributor

bricelam commented May 20, 2021

EF Core 6 will only support .net 5/6 - but this file is global, and also works for 3.1??

Correct, you can use the 6.0 tools with 2.1 projects. This happens when you have a solution with both an EF Core 6 and EF Core 2.1/3.1 project.

@bricelam bricelam self-assigned this May 20, 2021
@ErikEJ
Copy link
Contributor Author

ErikEJ commented May 20, 2021

I can update for Add-Migration?

@bricelam bricelam merged commit 40f3640 into dotnet:main Jun 7, 2021
@ErikEJ
Copy link
Contributor Author

ErikEJ commented Jun 18, 2021

@ajcvickers I don't want to nitpick, but I think you forgot to label this "community contribution"

@ajcvickers
Copy link
Member

@ErikEJ I'm way behind with this...

@ronaldhoek
Copy link

This speaks about 'conditionally' adding the created script files (in the past I already noticed, that remove-migration would not remove the file from the project - so might that also be related).

But based on what/which condition(s)?

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.

Don't use AddFromFile() in Scaffold-DbContext
5 participants