C# 带动作参数的Powershell方法
如何在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.PerformUpgradeC# 带动作参数的Powershell方法,c#,powershell,C#,Powershell,如何在Powershell中执行将Action作为参数的方法 upgradeEngine.Configurec=>c.ScriptExecutor.ExecutionTimeoutSeconds=15*60; C代码: var upgradeEngine=DeployChanges.To .SqlDatabaseconnectionString .WithScriptSembedInAsemblyAssembly.GetExecutionGasAssembly .LogToConsole; //
用适当的签名构造脚本块,并将其转换为[Action[T]]
GSerg,这个方法中没有参数的用法我不确定你的意思,但是委托接受一个参数$i并使用它。
$delegate = [System.Action[DbUp.Builder.UpgradeConfiguration]]{
param([DbUp.Builder.UpgradeConfiguration]$c)
$c.ScriptExecutor.ExecutionTimeoutSeconds = 15 * 60
}
$DbUp.Configure($delegate)