Skip to content

ServiceResponse

SAIF.Application.ServiceResponse is the library's service result container. It aggregates categorized ServiceMessage instances, exposes filtered views, and converts exceptions into environment messages.

Purpose

  • Return grouped service outcome messages to callers.
  • Provide a standard exception-to-message conversion path for service-oriented managers.

Context

  • Namespace: SAIF.Application
  • Assembly/package: SAIF.BOF.Application

Public members

Member Signature Purpose
Result Public Result As Boolean = True Store the overall success flag for the response.
RequestID Public RequestID As String = String.Empty Store the request identifier associated with the response.
Messages Public ReadOnly Property Messages As IEnumerable(Of ServiceMessage) Return the complete in-memory message collection.
Errors Public ReadOnly Property Errors As IEnumerable(Of ServiceMessage) Return only Error-typed messages.
EnvironmentalErrors Public ReadOnly Property EnvironmentalErrors As IEnumerable(Of ServiceMessage) Return only Environment-typed messages.
Warnings Public ReadOnly Property Warnings As IEnumerable(Of ServiceMessage) Return only Warning-typed messages.
InformationalMessages Public ReadOnly Property InformationalMessages As IEnumerable(Of ServiceMessage) Return only Information-typed messages.
ProcessException Public Sub ProcessException(ByVal ex As Exception) Add the exception message and attempted inner-exception messages as environment messages.
AddErrorMessage Public Sub AddErrorMessage(ByVal inMessage As String, Optional ByVal inKey As String = "") Append an Error-typed ServiceMessage.
AddWarningMessage Public Sub AddWarningMessage(ByVal inMessage As String, Optional ByVal inKey As String = "") Append a Warning-typed ServiceMessage.
AddInformationMessage Public Sub AddInformationMessage(ByVal inMessage As String, Optional ByVal inKey As String = "") Append an Information-typed ServiceMessage.
AddEnvironmentMessage Public Sub AddEnvironmentMessage(ByVal inMessage As String, Optional ByVal inKey As String = "") Append an Environment-typed ServiceMessage.

Behavioral notes

  • ProcessException(ex) adds the root exception message and then attempts to append inner-exception messages as Environment-typed ServiceMessage entries.
  • The type implements the service message/result pattern described in the library architecture documentation.

Constraints and usage notes

  • The response groups messages by ServiceMessageType rather than by calling operation.
  • Exception conversion focuses on response messaging; it does not itself resolve or retry failures.

Sources

  • Application\SAIF.Application\Service Based\ServiceResponse.vb
  • Application\SAIF.Application\Service Based\ServiceMessage.vb
  • Application\SAIF.Application\Service Based\ServiceEnums.vb