Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify Get-DbContext command to list DbContexts
Browse files Browse the repository at this point in the history
ErikEJ committed May 8, 2019
1 parent ccdea10 commit 041f501
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/EFCore.Tools/tools/EntityFrameworkCore.psm1
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ Register-TabExpansion Get-DbContext @{

<#
.SYNOPSIS
Gets information about a DbContext type.
Gets information about DbContext types.
.DESCRIPTION
Gets information about a DbContext type.
@@ -172,11 +172,19 @@ function Get-DbContext
$dteProject = GetProject $Project
$dteStartupProject = GetStartupProject $StartupProject $dteProject

$params = 'dbcontext', 'info', '--json'
$params += GetParams $Context

# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
return (EF $dteProject $dteStartupProject $params) -join "`n" | ConvertFrom-Json
if ($Context)
{
$params = 'dbcontext', 'info', '--json'
$params += GetParams $Context
# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
return (EF $dteProject $dteStartupProject $params) -join "`n" | ConvertFrom-Json
}
else
{
$params = 'dbcontext', 'list', '--json'
# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
return (EF $dteProject $dteStartupProject $params) -join "`n" | ConvertFrom-Json | Format-Table -Property safeName -HideTableHeaders
}
}

#

0 comments on commit 041f501

Please sign in to comment.