From f0c423598d14c85e5b694dfcde7a6277030d9379 Mon Sep 17 00:00:00 2001 From: wayne Date: Thu, 14 Nov 2024 20:37:19 +0800 Subject: [PATCH] Collect messages --- .../RepositoryPattern/ServiceResult.cs | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/EasyFrameWork/RepositoryPattern/ServiceResult.cs b/src/EasyFrameWork/RepositoryPattern/ServiceResult.cs index 369fde71..80b95594 100644 --- a/src/EasyFrameWork/RepositoryPattern/ServiceResult.cs +++ b/src/EasyFrameWork/RepositoryPattern/ServiceResult.cs @@ -79,12 +79,9 @@ public string ErrorMessage { var msg = new StringBuilder(); - foreach (Violation item in Errors) + foreach (var item in Errors) { - if (item is Error) - { - msg.AppendLine(item.Message); - } + msg.AppendLine(item.Message); } return msg.ToString(); } @@ -108,12 +105,9 @@ public string WarningMessage get { var msg = new StringBuilder(); - foreach (Violation item in _ruleViolations) + foreach (var item in Warnings) { - if (item is Warning) - { - msg.AppendLine(item.Message); - } + msg.AppendLine(item.Message); } return msg.ToString(); } @@ -136,12 +130,9 @@ public string InfoMessage get { var msg = new StringBuilder(); - foreach (Violation item in _ruleViolations) + foreach (var item in Infos) { - if (item is Info) - { - msg.AppendLine(item.Message); - } + msg.AppendLine(item.Message); } return msg.ToString(); }