MessageContainer¶
Implements IMessageContainer as a simple in-memory collector of validation errors and warnings, used by ClaimReportingService.CreateTask to capture messages from ITaskService.CreateTaskStateless and surface them on the per-item ReportItem.TaskErrorMessage.
Purpose¶
- Collects named validation errors (property name to message) added during an operation.
- Collects free-form warning messages added during an operation.
- Exposes whether any errors were recorded, and formats collected errors/warnings into single comma-separated strings for display.
Context¶
- Namespace:
SAIF.Services.Claims.Reports - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| AddError(propertyName, message) | public void AddError(string propertyName, string message) |
Records an error message keyed by property name; throws if the same property name is added twice (backed by a Dictionary). |
| AddInformation(message) | public void AddInformation(string message) |
No-op; informational messages are accepted but discarded and not stored. |
| AddWarning(message) | public void AddWarning(string message) |
Appends the message to the internal warnings list. |
| HasErrors | public bool HasErrors { get; } |
Indicates whether at least one error has been recorded. |
| ErrorMessages | public string ErrorMessages { get; } |
Returns all recorded errors formatted as "PropertyName: Message" entries joined by commas. |
| WarningMessages | public string WarningMessages { get; } |
Returns all recorded warnings joined by commas. |
Behavioral notes¶
AddInformationis a deliberate no-op — informational messages passed to this container are silently dropped, unlike errors and warnings.AddErrorusesDictionary.Add, which throwsArgumentExceptionif a duplicatepropertyNamekey is added, rather than overwriting or appending.*
Constraints and usage notes¶
- Because
AddErrorkeys by property name, only one error message per property name can be recorded per container instance.
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
- Services/SAIF.Services/Claims/Reports/ClaimReportingService.cs