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

Modify Get-DbContext command to list DbContexts #15652

Merged
merged 1 commit into from
May 8, 2019

Conversation

ErikEJ
Copy link
Contributor

@ErikEJ ErikEJ commented May 8, 2019

fixes #15104

Sample:

PM> Get-DbContext

AzureDbContext   
AzureOtherContext

PM> Get-DbContext -Context AzureDbContext

providerName                            databaseName dataSource             options
------------                            ------------ ----------             -------
Microsoft.EntityFrameworkCore.SqlServer AzureData    (localdb)\MSSQLLocalDB None   

@natemcmaster
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ajcvickers ajcvickers merged commit e174319 into dotnet:master May 8, 2019
{
$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
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Much easier than using a custom type with a formatting file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, Brice, I am complete PowerShell noob

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, looks like this doesn't work for scripting. The Format-Table cmdlet retuns Microsoft.PowerShell.Commands.Internal.Format objects instead of the json objects.

Copy link
Contributor

Choose a reason for hiding this comment

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

Filed #15673

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.

Add a PMC command that will list all DbContext types
4 participants