automapper框架优化

This commit is contained in:
2026-06-10 16:05:35 +08:00
parent 5452857299
commit 2e07c0c446
43 changed files with 612 additions and 293 deletions
+5 -5
View File
@@ -530,8 +530,8 @@ namespace ADP.ViewModels
// 读取 JSON 文件
string json = File.ReadAllText(filePath);
// 反序列化为 ProgramModel
var program = Newtonsoft.Json.JsonConvert.DeserializeObject<ProgramModel>(json);
// 反序列化为 ProgramVM
var program = Newtonsoft.Json.JsonConvert.DeserializeObject<ProgramVM>(json);
if (program == null)
{
@@ -621,12 +621,12 @@ namespace ADP.ViewModels
LoggerHelper.SuccessWithNotify($"工位 [{runningScope}] 程序保存成功!");
}
// 💡 辅助方法:建议将你的通用序列化落盘代码调整为接收 ProgramModel 参数,提高复用性
private void SaveProgramToFile(string filePath, ProgramModel programModel)
// 💡 辅助方法:建议将你的通用序列化落盘代码调整为接收 ProgramVM 参数,提高复用性
private void SaveProgramToFile(string filePath, ProgramVM ProgramVM)
{
try
{
string json = Newtonsoft.Json.JsonConvert.SerializeObject(programModel, Newtonsoft.Json.Formatting.Indented);
string json = Newtonsoft.Json.JsonConvert.SerializeObject(ProgramVM, Newtonsoft.Json.Formatting.Indented);
File.WriteAllText(filePath, json);
}
catch (Exception ex)