Files
MileageTraker/packages/EntityFramework.4.3.1/tools/install.ps1
T
2012-11-30 21:35:06 -05:00

37 lines
1.1 KiB
PowerShell

param($installPath, $toolsPath, $package, $project)
$invoker = @"
public class ConnectionFactoryConfiguratorInvoker
{
public static void Invoke(string assemblyPath, object project)
{
var appDomain = System.AppDomain.CreateDomain(
"EntityFramework.PowerShell",
null,
new System.AppDomainSetup { ShadowCopyFiles = "true" });
appDomain.CreateInstanceFrom(
assemblyPath,
"System.Data.Entity.ConnectionFactoryConfig.ConnectionFactoryConfigurator",
false,
0,
null,
new object[] { project },
null,
null);
System.AppDomain.Unload(appDomain);
}
}
"@
$version = (new-object System.Runtime.Versioning.FrameworkName($project.Properties.Item("TargetFrameworkMoniker").Value)).Version
if ($version -ge (new-object System.Version(4, 5)))
{
$dte.ItemOperations.OpenFile((Join-Path $toolsPath 'EF4.3on.NET4.5Readme.txt'))
}
Add-Type -TypeDefinition $invoker
[ConnectionFactoryConfiguratorInvoker]::Invoke((Join-Path $toolsPath "EntityFramework.PowerShell.dll"), $project)