Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/43.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 带动作参数的Powershell方法_C#_Powershell - Fatal编程技术网

C# 带动作参数的Powershell方法

C# 带动作参数的Powershell方法,c#,powershell,C#,Powershell,如何在Powershell中执行将Action作为参数的方法 upgradeEngine.Configurec=>c.ScriptExecutor.ExecutionTimeoutSeconds=15*60; C代码: var upgradeEngine=DeployChanges.To .SqlDatabaseconnectionString .WithScriptSembedInAsemblyAssembly.GetExecutionGasAssembly .LogToConsole; //

如何在Powershell中执行将Action作为参数的方法

upgradeEngine.Configurec=>c.ScriptExecutor.ExecutionTimeoutSeconds=15*60; C代码:

var upgradeEngine=DeployChanges.To .SqlDatabaseconnectionString .WithScriptSembedInAsemblyAssembly.GetExecutionGasAssembly .LogToConsole; //这条线 upgradeEngine.Configurec=>c.ScriptExecutor.ExecutionTimeoutSeconds=15*60; //这条线 升级引擎; 添加类型-Path连接路径-Path$currentPath-ChildPath'x:\location\of\DbUp.dll' $dbUp=[dbUp.DeployChanges]::到 $dbUp=[SqlServerExtensions]::SqlDatabase$dbUp,$connectionString $dbUp=[StandardExtensions]::使用ScriptsFromFileSystem$dbUp,$scriptPath $dbUp=[StandardExtensions]::LogToConsole$dbUp $upgradeResult=$dbUp.Build.PerformUpgrade
用适当的签名构造脚本块,并将其转换为[Action[T]]


GSerg,这个方法中没有参数的用法我不确定你的意思,但是委托接受一个参数$i并使用它。
$delegate = [System.Action[DbUp.Builder.UpgradeConfiguration]]{
  param([DbUp.Builder.UpgradeConfiguration]$c)
  $c.ScriptExecutor.ExecutionTimeoutSeconds = 15 * 60
}
$DbUp.Configure($delegate)