Skip to content

Commit

Permalink
PMC Tools: Work around PowerShell/PowerShell#3424 (#22134)
Browse files Browse the repository at this point in the history
  • Loading branch information
bricelam authored Aug 19, 2020
1 parent 897dc03 commit cc65d11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ function Get-DbContext
{
$params = 'dbcontext', 'list', '--json'
# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
return (EF $dteProject $dteStartupProject $params $Args) -join "`n" | ConvertFrom-Json | Format-Table -Property safeName -HideTableHeaders
# NB: Write-Output is here to break the JSON array into individual items
return (EF $dteProject $dteStartupProject $params $Args) -join "`n" | ConvertFrom-Json | Write-Output | Format-Table -Property safeName -HideTableHeaders
}
}

Expand Down Expand Up @@ -284,7 +285,8 @@ function Get-Migration
$params += GetParams $Context

# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
return (EF $dteProject $dteStartupProject $params $Args) -join "`n" | ConvertFrom-Json
# NB: Write-Output is here to break the JSON array into individual items
return (EF $dteProject $dteStartupProject $params $Args) -join "`n" | ConvertFrom-Json | Write-Output
}

#
Expand Down Expand Up @@ -821,7 +823,8 @@ function GetContextTypes($projectName, $startupProjectName)
$params = 'dbcontext', 'list', '--json'

# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
$result = (EF $project $startupProject $params $null -skipBuild) -join "`n" | ConvertFrom-Json
# NB: Write-Output is here to break the JSON array into individual items
$result = (EF $project $startupProject $params $null -skipBuild) -join "`n" | ConvertFrom-Json | Write-Output

return $result | %{ $_.safeName }
}
Expand All @@ -835,7 +838,8 @@ function GetMigrations($context, $projectName, $startupProjectName)
$params += GetParams $context

# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
$result = (EF $project $startupProject $params $null -skipBuild) -join "`n" | ConvertFrom-Json
# NB: Write-Output is here to break the JSON array into individual items
$result = (EF $project $startupProject $params $null -skipBuild) -join "`n" | ConvertFrom-Json | Write-Output

return $result | %{ $_.safeName }
}
Expand Down

0 comments on commit cc65d11

Please sign in to comment.