You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/Job_DSWMS_REPORT/packages/EntityFramework.6.4.4/tools/EntityFramework6.psm1

1408 lines
51 KiB
PowerShell

2 years ago
# Copyright (c) Microsoft Corporation. All rights reserved.
$ErrorActionPreference = 'Stop'
$InitialDatabase = '0'
<#
.SYNOPSIS
Adds or updates an Entity Framework provider entry in the project config
file.
.DESCRIPTION
Adds an entry into the 'entityFramework' section of the project config
file for the specified provider invariant name and provider type. If an
entry for the given invariant name already exists, then that entry is
updated with the given type name, unless the given type name already
matches, in which case no action is taken. The 'entityFramework'
section is added if it does not exist. The config file is automatically
saved if and only if a change was made.
This command is typically used only by Entity Framework provider NuGet
packages and is run from the 'install.ps1' script.
.PARAMETER Project
The Visual Studio project to update. When running in the NuGet install.ps1
script the '$project' variable provided as part of that script should be
used.
.PARAMETER InvariantName
The provider invariant name that uniquely identifies this provider. For
example, the Microsoft SQL Server provider is registered with the invariant
name 'System.Data.SqlClient'.
.PARAMETER TypeName
The assembly-qualified type name of the provider-specific type that
inherits from 'System.Data.Entity.Core.Common.DbProviderServices'. For
example, for the Microsoft SQL Server provider, this type is
'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'.
#>
function Add-EFProvider
{
[CmdletBinding(PositionalBinding = $false)]
param(
[parameter(Position = 0, Mandatory = $true)]
$Project,
[parameter(Position = 1, Mandatory = $true)]
[string] $InvariantName,
[parameter(Position = 2, Mandatory = $true)]
[string] $TypeName)
$configPath = GetConfigPath $Project
if (!$configPath)
{
return
}
[xml] $configXml = Get-Content $configPath
$providers = $configXml.configuration.entityFramework.providers
$providers.provider |
where invariantName -eq $InvariantName |
%{ $providers.RemoveChild($_) | Out-Null }
$provider = $providers.AppendChild($configXml.CreateElement('provider'))
$provider.SetAttribute('invariantName', $InvariantName)
$provider.SetAttribute('type', $TypeName)
$configXml.Save($configPath)
}
<#
.SYNOPSIS
Adds or updates an Entity Framework default connection factory in the
project config file.
.DESCRIPTION
Adds an entry into the 'entityFramework' section of the project config
file for the connection factory that Entity Framework will use by default
when creating new connections by convention. Any existing entry will be
overridden if it does not match. The 'entityFramework' section is added if
it does not exist. The config file is automatically saved if and only if
a change was made.
This command is typically used only by Entity Framework provider NuGet
packages and is run from the 'install.ps1' script.
.PARAMETER Project
The Visual Studio project to update. When running in the NuGet install.ps1
script the '$project' variable provided as part of that script should be
used.
.PARAMETER TypeName
The assembly-qualified type name of the connection factory type that
implements the 'System.Data.Entity.Infrastructure.IDbConnectionFactory'
interface. For example, for the Microsoft SQL Server Express provider
connection factory, this type is
'System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework'.
.PARAMETER ConstructorArguments
An optional array of strings that will be passed as arguments to the
connection factory type constructor.
#>
function Add-EFDefaultConnectionFactory
{
[CmdletBinding(PositionalBinding = $false)]
param(
[parameter(Position = 0, Mandatory = $true)]
$Project,
[parameter(Position = 1, Mandatory = $true)]
[string] $TypeName,
[string[]] $ConstructorArguments)
$configPath = GetConfigPath $Project
if (!$configPath)
{
return
}
[xml] $configXml = Get-Content $configPath
$entityFramework = $configXml.configuration.entityFramework
$defaultConnectionFactory = $entityFramework.defaultConnectionFactory
if ($defaultConnectionFactory)
{
$entityFramework.RemoveChild($defaultConnectionFactory) | Out-Null
}
$defaultConnectionFactory = $entityFramework.AppendChild($configXml.CreateElement('defaultConnectionFactory'))
$defaultConnectionFactory.SetAttribute('type', $TypeName)
if ($ConstructorArguments)
{
$parameters = $defaultConnectionFactory.AppendChild($configXml.CreateElement('parameters'))
foreach ($constructorArgument in $ConstructorArguments)
{
$parameter = $parameters.AppendChild($configXml.CreateElement('parameter'))
$parameter.SetAttribute('value', $constructorArgument)
}
}
$configXml.Save($configPath)
}
<#
.SYNOPSIS
Enables Code First Migrations in a project.
.DESCRIPTION
Enables Migrations by scaffolding a migrations configuration class in the project. If the
target database was created by an initializer, an initial migration will be created (unless
automatic migrations are enabled via the EnableAutomaticMigrations parameter).
.PARAMETER ContextTypeName
Specifies the context to use. If omitted, migrations will attempt to locate a
single context type in the target project.
.PARAMETER EnableAutomaticMigrations
Specifies whether automatic migrations will be enabled in the scaffolded migrations configuration.
If omitted, automatic migrations will be disabled.
.PARAMETER MigrationsDirectory
Specifies the name of the directory that will contain migrations code files.
If omitted, the directory will be named "Migrations".
.PARAMETER ProjectName
Specifies the project that the scaffolded migrations configuration class will
be added to. If omitted, the default project selected in package manager
console is used.
.PARAMETER StartUpProjectName
Specifies the configuration file to use for named connection strings. If
omitted, the specified project's configuration file is used.
.PARAMETER ContextProjectName
Specifies the project which contains the DbContext class to use. If omitted,
the context is assumed to be in the same project used for migrations.
.PARAMETER ConnectionStringName
Specifies the name of a connection string to use from the application's
configuration file.
.PARAMETER ConnectionString
Specifies the connection string to use. If omitted, the context's
default connection will be used.
.PARAMETER ConnectionProviderName
Specifies the provider invariant name of the connection string.
.PARAMETER Force
Specifies that the migrations configuration be overwritten when running more
than once for a given project.
.PARAMETER ContextAssemblyName
Specifies the name of the assembly which contains the DbContext class to use. Use this
parameter instead of ContextProjectName when the context is contained in a referenced
assembly rather than in a project of the solution.
.PARAMETER AppDomainBaseDirectory
Specifies the directory to use for the app-domain that is used for running Migrations
code such that the app-domain is able to find all required assemblies. This is an
advanced option that should only be needed if the solution contains several projects
such that the assemblies needed for the context and configuration are not all
referenced from either the project containing the context or the project containing
the migrations.
.EXAMPLE
Enable-Migrations
# Scaffold a migrations configuration in a project with only one context
.EXAMPLE
Enable-Migrations -Auto
# Scaffold a migrations configuration with automatic migrations enabled for a project
# with only one context
.EXAMPLE
Enable-Migrations -ContextTypeName MyContext -MigrationsDirectory DirectoryName
# Scaffold a migrations configuration for a project with multiple contexts
# This scaffolds a migrations configuration for MyContext and will put the configuration
# and subsequent configurations in a new directory called "DirectoryName"
#>
function Enable-Migrations
{
[CmdletBinding(DefaultParameterSetName = 'ConnectionStringName', PositionalBinding = $false)]
param(
[string] $ContextTypeName,
[alias('Auto')]
[switch] $EnableAutomaticMigrations,
[string] $MigrationsDirectory,
[string] $ProjectName,
[string] $StartUpProjectName,
[string] $ContextProjectName,
[parameter(ParameterSetName = 'ConnectionStringName')]
[string] $ConnectionStringName,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionString,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionProviderName,
[switch] $Force,
[string] $ContextAssemblyName,
[string] $AppDomainBaseDirectory)
WarnIfOtherEFs 'Enable-Migrations'
$project = GetProject $ProjectName
$startupProject = GetStartupProject $StartUpProjectName $project
if (!$ContextAssemblyName -and $ContextProjectName)
{
$contextProject = Get-Project $ContextProjectName
$ContextAssemblyName = GetProperty $contextProject.Properties 'AssemblyName'
}
$params = 'migrations', 'enable', '--json'
if ($ContextTypeName)
{
$params += '--context', $ContextTypeName
}
if ($ContextAssemblyName)
{
$params += '--context-assembly', $ContextAssemblyName
}
if ($EnableAutomaticMigrations)
{
$params += '--auto'
}
if ($MigrationsDirectory)
{
$params += '--migrations-dir', $MigrationsDirectory
}
$params += GetParams $ConnectionStringName $ConnectionString $ConnectionProviderName
if ($Force)
{
$params += '--force'
}
# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
$result = (EF6 $project $startupProject $AppDomainBaseDirectory $params) -join "`n" | ConvertFrom-Json
$project.ProjectItems.AddFromFile($result.migrationsConfiguration) | Out-Null
$DTE.ItemOperations.OpenFile($result.migrationsConfiguration) | Out-Null
ShowConsole
if ($result.migration)
{
$project.ProjectItems.AddFromFile($result.migration) | Out-Null
$resourcesProperties = $project.ProjectItems.AddFromFile($result.migrationResources).Properties
$project.ProjectItems.AddFromFile($result.migrationDesigner) | Out-Null
}
}
<#
.SYNOPSIS
Scaffolds a migration script for any pending model changes.
.DESCRIPTION
Scaffolds a new migration script and adds it to the project.
.PARAMETER Name
Specifies the name of the custom script.
.PARAMETER Force
Specifies that the migration user code be overwritten when re-scaffolding an
existing migration.
.PARAMETER ProjectName
Specifies the project that contains the migration configuration type to be
used. If omitted, the default project selected in package manager console
is used.
.PARAMETER StartUpProjectName
Specifies the configuration file to use for named connection strings. If
omitted, the specified project's configuration file is used.
.PARAMETER ConfigurationTypeName
Specifies the migrations configuration to use. If omitted, migrations will
attempt to locate a single migrations configuration type in the target
project.
.PARAMETER ConnectionStringName
Specifies the name of a connection string to use from the application's
configuration file.
.PARAMETER ConnectionString
Specifies the connection string to use. If omitted, the context's
default connection will be used.
.PARAMETER ConnectionProviderName
Specifies the provider invariant name of the connection string.
.PARAMETER IgnoreChanges
Scaffolds an empty migration ignoring any pending changes detected in the current model.
This can be used to create an initial, empty migration to enable Migrations for an existing
database. N.B. Doing this assumes that the target database schema is compatible with the
current model.
.PARAMETER AppDomainBaseDirectory
Specifies the directory to use for the app-domain that is used for running Migrations
code such that the app-domain is able to find all required assemblies. This is an
advanced option that should only be needed if the solution contains several projects
such that the assemblies needed for the context and configuration are not all
referenced from either the project containing the context or the project containing
the migrations.
.EXAMPLE
Add-Migration First
# Scaffold a new migration named "First"
.EXAMPLE
Add-Migration First -IgnoreChanges
# Scaffold an empty migration ignoring any pending changes detected in the current model.
# This can be used to create an initial, empty migration to enable Migrations for an existing
# database. N.B. Doing this assumes that the target database schema is compatible with the
# current model.
#>
function Add-Migration
{
[CmdletBinding(DefaultParameterSetName = 'ConnectionStringName', PositionalBinding = $false)]
param(
[parameter(Position = 0, Mandatory = $true)]
[string] $Name,
[switch] $Force,
[string] $ProjectName,
[string] $StartUpProjectName,
[string] $ConfigurationTypeName,
[parameter(ParameterSetName = 'ConnectionStringName')]
[string] $ConnectionStringName,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionString,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionProviderName,
[switch] $IgnoreChanges,
[string] $AppDomainBaseDirectory)
WarnIfOtherEFs 'Add-Migration'
$project = GetProject $ProjectName
$startupProject = GetStartupProject $StartUpProjectName $project
$params = 'migrations', 'add', $Name, '--json'
if ($Force)
{
$params += '--force'
}
if ($ConfigurationTypeName)
{
$params += '--migrations-config', $ConfigurationTypeName
}
if ($IgnoreChanges)
{
$params += '--ignore-changes'
}
$params += GetParams $ConnectionStringName $ConnectionString $ConnectionProviderName
# NB: -join is here to support ConvertFrom-Json on PowerShell 3.0
$result = (EF6 $project $startupProject $AppDomainBaseDirectory $params) -join "`n" | ConvertFrom-Json
$project.ProjectItems.AddFromFile($result.migration) | Out-Null
$DTE.ItemOperations.OpenFile($result.migration) | Out-Null
$resourcesProperties = $project.ProjectItems.AddFromFile($result.migrationResources).Properties
$project.ProjectItems.AddFromFile($result.migrationDesigner) | Out-Null
}
<#
.SYNOPSIS
Applies any pending migrations to the database.
.DESCRIPTION
Updates the database to the current model by applying pending migrations.
.PARAMETER SourceMigration
Only valid with -Script. Specifies the name of a particular migration to use
as the update's starting point. If omitted, the last applied migration in
the database will be used.
.PARAMETER TargetMigration
Specifies the name of a particular migration to update the database to. If
omitted, the current model will be used.
.PARAMETER Script
Generate a SQL script rather than executing the pending changes directly.
.PARAMETER Force
Specifies that data loss is acceptable during automatic migration of the
database.
.PARAMETER ProjectName
Specifies the project that contains the migration configuration type to be
used. If omitted, the default project selected in package manager console
is used.
.PARAMETER StartUpProjectName
Specifies the configuration file to use for named connection strings. If
omitted, the specified project's configuration file is used.
.PARAMETER ConfigurationTypeName
Specifies the migrations configuration to use. If omitted, migrations will
attempt to locate a single migrations configuration type in the target
project.
.PARAMETER ConnectionStringName
Specifies the name of a connection string to use from the application's
configuration file.
.PARAMETER ConnectionString
Specifies the connection string to use. If omitted, the context's
default connection will be used.
.PARAMETER ConnectionProviderName
Specifies the provider invariant name of the connection string.
.PARAMETER AppDomainBaseDirectory
Specifies the directory to use for the app-domain that is used for running Migrations
code such that the app-domain is able to find all required assemblies. This is an
advanced option that should only be needed if the solution contains several projects
such that the assemblies needed for the context and configuration are not all
referenced from either the project containing the context or the project containing
the migrations.
.EXAMPLE
Update-Database
# Update the database to the latest migration
.EXAMPLE
Update-Database -TargetMigration Second
# Update database to a migration named "Second"
# This will apply migrations if the target hasn't been applied or roll back migrations
# if it has
.EXAMPLE
Update-Database -Script
# Generate a script to update the database from its current state to the latest migration
.EXAMPLE
Update-Database -Script -SourceMigration Second -TargetMigration First
# Generate a script to migrate the database from a specified start migration
# named "Second" to a specified target migration named "First"
.EXAMPLE
Update-Database -Script -SourceMigration $InitialDatabase
# Generate a script that can upgrade a database currently at any version to the latest version.
# The generated script includes logic to check the __MigrationsHistory table and only apply changes
# that haven't been previously applied.
.EXAMPLE
Update-Database -TargetMigration $InitialDatabase
# Runs the Down method to roll-back any migrations that have been applied to the database
#>
function Update-Database
{
[CmdletBinding(DefaultParameterSetName = 'ConnectionStringName', PositionalBinding = $false)]
param(
[string] $SourceMigration,
[string] $TargetMigration,
[switch] $Script,
[switch] $Force,
[string] $ProjectName,
[string] $StartUpProjectName,
[string] $ConfigurationTypeName,
[parameter(ParameterSetName = 'ConnectionStringName')]
[string] $ConnectionStringName,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionString,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionProviderName,
[string] $AppDomainBaseDirectory)
WarnIfOtherEFs 'Update-Database'
$project = GetProject $ProjectName
$startupProject = GetStartupProject $StartUpProjectName $project
$params = 'database', 'update'
if ($SourceMigration)
{
$params += '--source', $SourceMigration
}
if ($TargetMigration)
{
$params += '--target', $TargetMigration
}
if ($Script)
{
$params += '--script'
}
if ($Force)
{
$params += '--force'
}
if ($ConfigurationTypeName)
{
$params += '--migrations-config', $ConfigurationTypeName
}
$params += GetParams $ConnectionStringName $ConnectionString $ConnectionProviderName
$result = (EF6 $project $startupProject $AppDomainBaseDirectory $params) -join "`n"
if ($result)
{
try
{
$window = $DTE.ItemOperations.NewFile('General\Sql File')
$textDocument = $window.Document.Object('TextDocument')
$editPoint = $textDocument.StartPoint.CreateEditPoint()
$editPoint.Insert($result)
}
catch
{
$intermediatePath = GetIntermediatePath $project
if (![IO.Path]::IsPathRooted($intermediatePath))
{
$projectDir = GetProperty $project.Properties 'FullPath'
$intermediatePath = Join-Path $projectDir $intermediatePath -Resolve | Convert-Path
}
$fileName = [IO.Path]::ChangeExtension([IO.Path]::GetRandomFileName(), '.sql')
$sqlFile = Join-Path $intermediatePath $fileName
[IO.File]::WriteAllText($sqlFile, $result)
$DTE.ItemOperations.OpenFile($sqlFile) | Out-Null
}
ShowConsole
}
}
<#
.SYNOPSIS
Displays the migrations that have been applied to the target database.
.DESCRIPTION
Displays the migrations that have been applied to the target database.
.PARAMETER ProjectName
Specifies the project that contains the migration configuration type to be
used. If omitted, the default project selected in package manager console
is used.
.PARAMETER StartUpProjectName
Specifies the configuration file to use for named connection strings. If
omitted, the specified project's configuration file is used.
.PARAMETER ConfigurationTypeName
Specifies the migrations configuration to use. If omitted, migrations will
attempt to locate a single migrations configuration type in the target
project.
.PARAMETER ConnectionStringName
Specifies the name of a connection string to use from the application's
configuration file.
.PARAMETER ConnectionString
Specifies the connection string to use. If omitted, the context's
default connection will be used.
.PARAMETER ConnectionProviderName
Specifies the provider invariant name of the connection string.
.PARAMETER AppDomainBaseDirectory
Specifies the directory to use for the app-domain that is used for running Migrations
code such that the app-domain is able to find all required assemblies. This is an
advanced option that should only be needed if the solution contains several projects
such that the assemblies needed for the context and configuration are not all
referenced from either the project containing the context or the project containing
the migrations.
#>
function Get-Migrations
{
[CmdletBinding(DefaultParameterSetName = 'ConnectionStringName', PositionalBinding = $false)]
param(
[string] $ProjectName,
[string] $StartUpProjectName,
[string] $ConfigurationTypeName,
[parameter(ParameterSetName = 'ConnectionStringName')]
[string] $ConnectionStringName,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionString,
[parameter(ParameterSetName = 'ConnectionStringAndProviderName', Mandatory = $true)]
[string] $ConnectionProviderName,
[string] $AppDomainBaseDirectory)
WarnIfOtherEFs 'Get-Migrations'
$project = GetProject $ProjectName
$startupProject = GetStartupProject $StartUpProjectName $project
$params = 'migrations', 'list'
if ($ConfigurationTypeName)
{
$params += '--migrations-config', $ConfigurationTypeName
}
$params += GetParams $ConnectionStringName $ConnectionString $ConnectionProviderName
return EF6 $project $startupProject $AppDomainBaseDirectory $params
}
function WarnIfOtherEFs($cmdlet)
{
if (Get-Module 'EntityFrameworkCore')
{
Write-Warning "Both Entity Framework 6 and Entity Framework Core are installed. The Entity Framework 6 tools are running. Use 'EntityFrameworkCore\$cmdlet' for Entity Framework Core."
}
if (Get-Module 'EntityFramework')
{
Write-Warning "A version of Entity Framework older than 6.3 is also installed. The newer tools are running. Use 'EntityFramework\$cmdlet' for the older version."
}
}
function GetProject($projectName)
{
if (!$projectName)
{
return Get-Project
}
return Get-Project $projectName
}
function GetStartupProject($name, $fallbackProject)
{
if ($name)
{
return Get-Project $name
}
$startupProjectPaths = $DTE.Solution.SolutionBuild.StartupProjects
if ($startupProjectPaths)
{
if ($startupProjectPaths.Length -eq 1)
{
$startupProjectPath = $startupProjectPaths[0]
if (![IO.Path]::IsPathRooted($startupProjectPath))
{
$solutionPath = Split-Path (GetProperty $DTE.Solution.Properties 'Path')
$startupProjectPath = Join-Path $solutionPath $startupProjectPath -Resolve | Convert-Path
}
$startupProject = GetSolutionProjects |
?{
try
{
$fullName = $_.FullName
}
catch [NotImplementedException]
{
return $false
}
if ($fullName -and $fullName.EndsWith('\'))
{
$fullName = $fullName.Substring(0, $fullName.Length - 1)
}
return $fullName -eq $startupProjectPath
}
if ($startupProject)
{
return $startupProject
}
Write-Warning "Unable to resolve startup project '$startupProjectPath'."
}
else
{
Write-Warning 'Multiple startup projects set.'
}
}
else
{
Write-Warning 'No startup project set.'
}
Write-Warning "Using project '$($fallbackProject.ProjectName)' as the startup project."
return $fallbackProject
}
function GetSolutionProjects()
{
$projects = New-Object 'System.Collections.Stack'
$DTE.Solution.Projects |
%{ $projects.Push($_) }
while ($projects.Count)
{
$project = $projects.Pop();
<# yield return #> $project
if ($project.ProjectItems)
{
$project.ProjectItems |
?{ $_.SubProject } |
%{ $projects.Push($_.SubProject) }
}
}
}
function GetParams($connectionStringName, $connectionString, $connectionProviderName)
{
$params = @()
if ($connectionStringName)
{
$params += '--connection-string-name', $connectionStringName
}
if ($connectionString)
{
$params += '--connection-string', $connectionString,
'--connection-provider', $connectionProviderName
}
return $params
}
function ShowConsole
{
$componentModel = Get-VSComponentModel
$powerConsoleWindow = $componentModel.GetService([NuGetConsole.IPowerConsoleWindow])
$powerConsoleWindow.Show()
}
function WriteErrorLine($message)
{
try
{
# Call the internal API NuGet uses to display errors
$componentModel = Get-VSComponentModel
$powerConsoleWindow = $componentModel.GetService([NuGetConsole.IPowerConsoleWindow])
$bindingFlags = [Reflection.BindingFlags]::Instance -bor [Reflection.BindingFlags]::NonPublic
$activeHostInfo = $powerConsoleWindow.GetType().GetProperty('ActiveHostInfo', $bindingFlags).GetValue($powerConsoleWindow)
$internalHost = $activeHostInfo.WpfConsole.Host
$reportErrorMethod = $internalHost.GetType().GetMethod('ReportError', $bindingFlags, $null, [Exception], $null)
$exception = New-Object Exception $message
$reportErrorMethod.Invoke($internalHost, $exception)
}
catch
{
Write-Host $message -ForegroundColor DarkRed
}
}
function EF6($project, $startupProject, $workingDir, $params)
{
$solutionBuild = $DTE.Solution.SolutionBuild
$solutionBuild.BuildProject(
$solutionBuild.ActiveConfiguration.Name,
$project.UniqueName,
<# WaitForBuildToFinish #> $true)
if ($solutionBuild.LastBuildInfo)
{
throw "The project '$($project.ProjectName)' failed to build."
}
$projectDir = GetProperty $project.Properties 'FullPath'
$outputPath = GetProperty $project.ConfigurationManager.ActiveConfiguration.Properties 'OutputPath'
$targetDir = [IO.Path]::GetFullPath([IO.Path]::Combine($projectDir, $outputPath))
$targetFrameworkMoniker = GetProperty $project.Properties 'TargetFrameworkMoniker'
$frameworkName = New-Object 'System.Runtime.Versioning.FrameworkName' $targetFrameworkMoniker
$targetFrameworkIdentifier = $frameworkName.Identifier
$targetFrameworkVersion = $frameworkName.Version
if ($targetFrameworkIdentifier -in '.NETFramework')
{
if ($targetFrameworkVersion -lt '4.5')
{
$frameworkDir = 'net40'
}
else
{
$frameworkDir = 'net45'
}
$platformTarget = GetPlatformTarget $project
if ($platformTarget -eq 'x86')
{
$runtimeDir = 'win-x86'
}
elseif ($platformTarget -in 'AnyCPU', 'x64')
{
$runtimeDir = 'any'
}
else
{
throw "Project '$($project.ProjectName)' has an active platform of '$platformTarget'. Select a different " +
'platform and try again.'
}
$exePath = Join-Path $PSScriptRoot "$frameworkDir\$runtimeDir\ef6.exe"
}
elseif ($targetFrameworkIdentifier -eq '.NETCoreApp')
{
$exePath = (Get-Command 'dotnet').Path
$targetName = GetProperty $project.Properties 'AssemblyName'
$depsFile = Join-Path $targetDir ($targetName + '.deps.json')
$projectAssetsFile = GetCpsProperty $project 'ProjectAssetsFile'
$runtimeConfig = Join-Path $targetDir ($targetName + '.runtimeconfig.json')
$runtimeFrameworkVersion = GetCpsProperty $project 'RuntimeFrameworkVersion'
$efPath = Join-Path $PSScriptRoot 'netcoreapp3.0\any\ef6.dll'
$dotnetParams = 'exec', '--depsfile', $depsFile
if ($projectAssetsFile)
{
# NB: Don't use Get-Content. It doesn't handle UTF-8 without a signature
# NB: Don't use ReadAllLines. ConvertFrom-Json won't work on PowerShell 3.0
$projectAssets = [IO.File]::ReadAllText($projectAssetsFile) | ConvertFrom-Json
$projectAssets.packageFolders.psobject.Properties.Name |
%{ $dotnetParams += '--additionalprobingpath', $_.TrimEnd('\') }
}
if (Test-Path $runtimeConfig)
{
$dotnetParams += '--runtimeconfig', $runtimeConfig
}
elseif ($runtimeFrameworkVersion)
{
$dotnetParams += '--fx-version', $runtimeFrameworkVersion
}
$dotnetParams += $efPath
$params = $dotnetParams + $params
}
else
{
throw "Project '$($startupProject.ProjectName)' targets framework '$targetFrameworkIdentifier'. The Entity Framework " +
'Package Manager Console Tools don''t support this framework.'
}
$targetFileName = GetProperty $project.Properties 'OutputFileName'
$targetPath = Join-Path $targetDir $targetFileName
$rootNamespace = GetProperty $project.Properties 'RootNamespace'
$language = GetLanguage $project
$params += '--verbose',
'--no-color',
'--prefix-output',
'--assembly', $targetPath,
'--project-dir', $projectDir,
'--language', $language
if (IsWeb $startupProject)
{
$startupProjectDir = GetProperty $startupProject.Properties 'FullPath'
$params += '--data-dir', (Join-Path $startupProjectDir 'App_Data')
}
if ($rootNamespace)
{
$params += '--root-namespace', $rootNamespace
}
$configFile = GetConfigPath $startupProject
if ($configFile)
{
$params += '--config', $configFile
}
if (!$workingDir)
{
$workingDir = $targetDir
}
$arguments = ToArguments $params
$startInfo = New-Object 'System.Diagnostics.ProcessStartInfo' -Property @{
FileName = $exePath;
Arguments = $arguments;
UseShellExecute = $false;
CreateNoWindow = $true;
RedirectStandardOutput = $true;
StandardOutputEncoding = [Text.Encoding]::UTF8;
RedirectStandardError = $true;
WorkingDirectory = $workingDir;
}
Write-Verbose "$exePath $arguments"
$process = [Diagnostics.Process]::Start($startInfo)
while (($line = $process.StandardOutput.ReadLine()) -ne $null)
{
$level = $null
$text = $null
$parts = $line.Split(':', 2)
if ($parts.Length -eq 2)
{
$level = $parts[0]
$i = 0
$count = 8 - $level.Length
while ($i -lt $count -and $parts[1][$i] -eq ' ')
{
$i++
}
$text = $parts[1].Substring($i)
}
switch ($level)
{
'error' { WriteErrorLine $text }
'warn' { Write-Warning $text }
'info' { Write-Host $text }
'data' { Write-Output $text }
'verbose' { Write-Verbose $text }
default { Write-Host $line }
}
}
$process.WaitForExit()
if ($process.ExitCode)
{
while (($line = $process.StandardError.ReadLine()) -ne $null)
{
WriteErrorLine $line
}
exit
}
}
function IsCpsProject($project)
{
$hierarchy = GetVsHierarchy $project
$isCapabilityMatch = [Microsoft.VisualStudio.Shell.PackageUtilities].GetMethod(
'IsCapabilityMatch',
[type[]]([Microsoft.VisualStudio.Shell.Interop.IVsHierarchy], [string]))
return $isCapabilityMatch.Invoke($null, ($hierarchy, 'CPS'))
}
function IsWeb($project)
{
$hierarchy = GetVsHierarchy $project
$aggregatableProject = Get-Interface $hierarchy 'Microsoft.VisualStudio.Shell.Interop.IVsAggregatableProject'
if (!$aggregatableProject)
{
$projectTypes = $project.Kind
}
else
{
$projectTypeGuids = $null
$hr = $aggregatableProject.GetAggregateProjectTypeGuids([ref] $projectTypeGuids)
[Runtime.InteropServices.Marshal]::ThrowExceptionForHR($hr)
$projectTypes = $projectTypeGuids.Split(';')
}
foreach ($projectType in $projectTypes)
{
if ($projectType -in '{349C5851-65DF-11DA-9384-00065B846F21}', '{E24C65DC-7377-472B-9ABA-BC803B73C61A}')
{
return $true
}
}
return $false;
}
function GetIntermediatePath($project)
{
$intermediatePath = GetProperty $project.ConfigurationManager.ActiveConfiguration.Properties 'IntermediatePath'
if ($intermediatePath)
{
return $intermediatePath
}
return GetMSBuildProperty $project 'IntermediateOutputPath'
}
function GetPlatformTarget($project)
{
if (IsCpsProject $project)
{
$platformTarget = GetCpsProperty $project 'PlatformTarget'
if ($platformTarget)
{
return $platformTarget
}
return GetCpsProperty $project 'Platform'
}
$platformTarget = GetProperty $project.ConfigurationManager.ActiveConfiguration.Properties 'PlatformTarget'
if ($platformTarget)
{
return $platformTarget
}
# NB: For classic F# projects
$platformTarget = GetMSBuildProperty $project 'PlatformTarget'
if ($platformTarget)
{
return $platformTarget
}
return 'AnyCPU'
}
function GetLanguage($project)
{
if (IsCpsProject $project)
{
return GetCpsProperty $project 'Language'
}
return GetMSBuildProperty $project 'Language'
}
function GetVsHierarchy($project)
{
$solution = Get-VSService 'Microsoft.VisualStudio.Shell.Interop.SVsSolution' 'Microsoft.VisualStudio.Shell.Interop.IVsSolution'
$hierarchy = $null
$hr = $solution.GetProjectOfUniqueName($project.UniqueName, [ref] $hierarchy)
[Runtime.InteropServices.Marshal]::ThrowExceptionForHR($hr)
return $hierarchy
}
function GetProperty($properties, $propertyName)
{
try
{
return $properties.Item($propertyName).Value
}
catch
{
return $null
}
}
function GetCpsProperty($project, $propertyName)
{
$browseObjectContext = Get-Interface $project 'Microsoft.VisualStudio.ProjectSystem.Properties.IVsBrowseObjectContext'
$unconfiguredProject = $browseObjectContext.UnconfiguredProject
$configuredProject = $unconfiguredProject.GetSuggestedConfiguredProjectAsync().Result
$properties = $configuredProject.Services.ProjectPropertiesProvider.GetCommonProperties()
return $properties.GetEvaluatedPropertyValueAsync($propertyName).Result
}
function GetMSBuildProperty($project, $propertyName)
{
$msbuildProject = [Microsoft.Build.Evaluation.ProjectCollection]::GlobalProjectCollection.LoadedProjects |
where FullPath -eq $project.FullName
return $msbuildProject.GetProperty($propertyName).EvaluatedValue
}
function ToArguments($params)
{
$arguments = ''
for ($i = 0; $i -lt $params.Length; $i++)
{
if ($i)
{
$arguments += ' '
}
if (!$params[$i].Contains(' '))
{
$arguments += $params[$i]
continue
}
$arguments += '"'
$pendingBackslashs = 0
for ($j = 0; $j -lt $params[$i].Length; $j++)
{
switch ($params[$i][$j])
{
'"'
{
if ($pendingBackslashs)
{
$arguments += '\' * $pendingBackslashs * 2
$pendingBackslashs = 0
}
$arguments += '\"'
}
'\'
{
$pendingBackslashs++
}
default
{
if ($pendingBackslashs)
{
if ($pendingBackslashs -eq 1)
{
$arguments += '\'
}
else
{
$arguments += '\' * $pendingBackslashs * 2
}
$pendingBackslashs = 0
}
$arguments += $params[$i][$j]
}
}
}
if ($pendingBackslashs)
{
$arguments += '\' * $pendingBackslashs * 2
}
$arguments += '"'
}
return $arguments
}
function GetConfigPath($project)
{
if (IsWeb $project)
{
$configFileName = 'web.config'
}
else
{
$configFileName = 'app.config'
}
$item = $project.ProjectItems |
where Name -eq $configFileName |
select -First 1
return GetProperty $item.Properties 'FullPath'
}
Export-ModuleMember 'Add-EFDefaultConnectionFactory', 'Add-EFProvider', 'Add-Migration', 'Enable-Migrations', 'Get-Migrations', 'Update-Database' -Variable 'InitialDatabase'
# SIG # Begin signature block
# MIIkXwYJKoZIhvcNAQcCoIIkUDCCJ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