FileSqlServerSync/Server/ServerTest/PipeSeed.cs
ZhaoLei 4724e96efe feat: 增加在各个步骤前后调用扩展命令
c# 异步任务里面的异常,不会在异步之外被捕获。
```
try {

Task.Run(()=>{

throw new Exception()
//此异常不会被捕获

)
};
catch(Exception ex) {
//将不会捕获异常
}
2024-10-29 12:46:13 +08:00

89 lines
2.7 KiB
C#

using Common;
using LocalServer;
using RemoteServer;
namespace ServerTest;
public class PipeSeed : IDisposable
{
public PipeSeed()
{
TestConfig = new Config
{
Name = "Test",
RemoteUrl = "D:/FileSyncTest/dtemp",
RemotePwd = "t123",
IsDeployDb = true,
IsDeployProject = true,
LocalProjectAbsolutePath = "D:/git/HMES-H7-HNFY/HMES-H7-HNFYMF/HMES-H7-HNFYMF.WEB",
LocalRootPath = "D:/FileSyncTest/src",
RemoteRootPath = "D:/FileSyncTest/dst",
SrcDb = new MSSqlConfig
{
ServerName = "172.16.12.2",
DatabaseName = "HMES_H7_HNFYMF",
User = "hmes-h7",
Password = "Hmes-h7666",
TrustServerCertificate = "True",
SyncTablesData = new List<string>
{
"dbo.sys_Button",
"dbo.sys_Menu",
"dbo.sys_Module",
"dbo.sys_Page",
}
},
DstDb = new MSSqlConfig
{
ServerName = "127.0.0.1",
DatabaseName = "HMES_H7_HNFYMF",
User = "sa",
Password = "0",
TrustServerCertificate = "True"
},
DirFileConfigs = new List<DirFileConfig>
{
new DirFileConfig { DirPath = "/bin", Excludes = ["/roslyn", "/Views"] }
},
// C:/Windows/System32/inetsrv/appcmd.exe stop sites "publicserver"
// C:/Windows/System32/inetsrv/appcmd.exe start sites "publicserver"
ExecProcesses = new List<ExecProcess>
{
new ExecProcess
{
Argumnets = "ls",
FileName = "powershell",
StepBeforeOrAfter = "A",
ExecInLocalOrServer = "L",
Step = SyncProcessStep.DeployProject,
},
new ExecProcess
{
Argumnets = "ls",
FileName = "powershell",
StepBeforeOrAfter = "B",
ExecInLocalOrServer = "S",
Step = SyncProcessStep.Publish,
},
new ExecProcess
{
Argumnets = "ls",
FileName = "powershell",
StepBeforeOrAfter = "A",
ExecInLocalOrServer = "S",
Step = SyncProcessStep.Publish,
},
}
};
}
public Config TestConfig;
public void Dispose()
{
GC.SuppressFinalize(this);
}
}