diff --git a/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 b/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 index eded374..d434151 100644 Binary files a/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 and b/.vs/DigitalData.Core/DesignTimeBuild/.dtbcache.v2 differ diff --git a/.vs/DigitalData.Core/v17/.suo b/.vs/DigitalData.Core/v17/.suo index fffeb3a..d9e1be3 100644 Binary files a/.vs/DigitalData.Core/v17/.suo and b/.vs/DigitalData.Core/v17/.suo differ diff --git a/DigitalData.Core.Application/AutoMapperExtension.cs b/DigitalData.Core.Application/AutoMapperExtension.cs new file mode 100644 index 0000000..bb61521 --- /dev/null +++ b/DigitalData.Core.Application/AutoMapperExtension.cs @@ -0,0 +1,22 @@ +using AutoMapper; + +namespace DigitalData.Core.Application +{ + public static class AutoMapperExtension + { + /// + /// Maps a source object to a destination object, or throws an exception if the mapping result is null. + /// + /// The source object type. + /// The destination object type. + /// The source object to map from. + /// The mapped destination object. + /// Thrown when the mapping result is null. + public static TDestination MapOrThrow(this IMapper mapper, object source) + { + return mapper.Map(source) ?? throw new AutoMapperMappingException( + $"Mapping to {typeof(TDestination).FullName} resulted in a null object. " + + "Hint: Ensure that the AutoMapper profile configuration for this mapping is correct."); + } + } +} diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs index c9acfd3..06c3074 100644 --- a/DigitalData.Core.Application/CRUDService.cs +++ b/DigitalData.Core.Application/CRUDService.cs @@ -20,7 +20,6 @@ namespace DigitalData.Core.Application { protected readonly TCRUDRepository _repository; protected readonly IMapper _mapper; - protected readonly IKeyTranslationService _translationService; protected readonly PropertyInfo? _keyPropertyInfo; /// @@ -29,10 +28,9 @@ namespace DigitalData.Core.Application /// The CRUD repository for accessing the database. /// The service for translating messages based on culture. /// The AutoMapper instance for mapping between DTOs and entity objects. - public CRUDService(TCRUDRepository repository, IKeyTranslationService translationService, IMapper mapper) + public CRUDService(TCRUDRepository repository, IKeyTranslationService translationService, IMapper mapper) : base(translationService) { _repository = repository; - _translationService = translationService; _mapper = mapper; _keyPropertyInfo = typeof(TEntity).GetProperties() @@ -96,7 +94,7 @@ namespace DigitalData.Core.Application else { var translatedMessage = _translationService.Translate(MessageKey.UpdateFailed); - return Failed(translatedMessage); + return Failed(); } } diff --git a/DigitalData.Core.Application/DirectorySearchService.cs b/DigitalData.Core.Application/DirectorySearchService.cs index f3262b1..86b9f47 100644 --- a/DigitalData.Core.Application/DirectorySearchService.cs +++ b/DigitalData.Core.Application/DirectorySearchService.cs @@ -5,6 +5,7 @@ using System.DirectoryServices; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Configuration; using System.DirectoryServices.AccountManagement; +using DigitalData.Core.Contracts.CultureServices; namespace DigitalData.Core.Application { @@ -18,7 +19,7 @@ namespace DigitalData.Core.Application private readonly DateTimeOffset _userCacheExpiration; public Dictionary CustomSearchFilters { get; } - public DirectorySearchService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache) + public DirectorySearchService(IConfiguration configuration, ILogger logger, IMemoryCache memoryCache, IKeyTranslationService translationService) : base(translationService) { _memoryCache = memoryCache; diff --git a/DigitalData.Core.Application/ResponseService.cs b/DigitalData.Core.Application/ResponseService.cs index e22b570..126bbba 100644 --- a/DigitalData.Core.Application/ResponseService.cs +++ b/DigitalData.Core.Application/ResponseService.cs @@ -1,13 +1,17 @@ using DigitalData.Core.Contracts.Application; +using DigitalData.Core.Contracts.CultureServices; using static System.Runtime.InteropServices.JavaScript.JSType; namespace DigitalData.Core.Application { - /// - /// Provides a base implementation of , offering basic service messaging and result creation functionalities. - /// public class ResponseService : IResponseService { + protected readonly IKeyTranslationService _translationService; + + public ResponseService(IKeyTranslationService translationService) + { + _translationService = translationService; + } #region WITHOUT_MESSAGE @@ -16,7 +20,11 @@ namespace DigitalData.Core.Application /// /// Indicates if the operation was successful. /// A service message reflecting the operation outcome. - public IServiceMessage CreateMessage(bool isSuccess) => new ServiceMessage(isSuccess); + public IServiceMessage CreateMessage(bool isSuccess = false) => new ServiceMessage() + { + IsSuccess = isSuccess, + KeyTranslator = _translationService.Translate + }; /// /// Creates a service result containing the provided data and a success flag, without additional messages. @@ -25,7 +33,12 @@ namespace DigitalData.Core.Application /// The data to include in the result. /// Indicates if the operation was successful. /// A service result with the specified data and outcome. - public IServiceResult CreateResult(T? data, bool isSuccess) => new ServiceResult(data, isSuccess); + public IServiceResult CreateResult(T? data = default, bool isSuccess = false) => new ServiceResult() + { + IsSuccess = isSuccess, + Data = data, + KeyTranslator = _translationService.Translate + }; /// /// Creates a service message indicating a successful operation without additional messages. @@ -56,9 +69,8 @@ namespace DigitalData.Core.Application public IServiceResult Failed(T? data = default) => CreateResult(data, false); #endregion - #region WITH_STRING_MESSAGE - + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a service message with the specified success flag and messages. /// @@ -67,6 +79,7 @@ namespace DigitalData.Core.Application /// A new instance of reflecting the operation outcome. public virtual IServiceMessage CreateMessage(bool isSuccess, params string[] messages) => new ServiceMessage(isSuccess, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a service result containing the provided data, success flag, and messages. /// @@ -77,6 +90,7 @@ namespace DigitalData.Core.Application /// A new instance of with the specified data and outcome. public virtual IServiceResult CreateResult(T? data = default, bool isSuccess = true, params string[] messages) => new ServiceResult(data, isSuccess, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a successful service message. /// @@ -84,6 +98,7 @@ namespace DigitalData.Core.Application /// A successful service message. public virtual IServiceMessage Successful(params string[] messages) => CreateMessage(true, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service message. /// @@ -91,6 +106,7 @@ namespace DigitalData.Core.Application /// A failed service message. public virtual IServiceMessage Failed(params string[] messages) => CreateMessage(false, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a successful service result with the provided data. /// @@ -100,6 +116,7 @@ namespace DigitalData.Core.Application /// A successful service result containing the specified data. public virtual IServiceResult Successful(T data, params string[] messages) => CreateResult(data, true, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service result, optionally including data. /// @@ -109,6 +126,7 @@ namespace DigitalData.Core.Application /// A failed service result, which may or may not contain the specified data. public virtual IServiceResult Failed(T? data = default, params string[] messages) => CreateResult(data, false, messages); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service result using only failure messages, without explicitly including data. /// @@ -125,6 +143,7 @@ namespace DigitalData.Core.Application #endregion #region WITH_ENUM_MESSAGE + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a service message with the specified success flag and enumeration messages. /// @@ -133,6 +152,7 @@ namespace DigitalData.Core.Application /// A new instance of reflecting the operation outcome with enumeration messages. public IServiceMessage CreateMessage(bool isSuccess, params Enum[] messages) => CreateMessage(isSuccess, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a service result containing the provided data, success flag, and enumeration messages. /// @@ -143,6 +163,7 @@ namespace DigitalData.Core.Application /// A new instance of with the specified data and outcome using enumeration messages. public IServiceResult CreateResult(T? data, bool isSuccess, params Enum[] messages) => CreateResult(data, isSuccess, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a successful service message using enumeration messages. /// @@ -150,6 +171,7 @@ namespace DigitalData.Core.Application /// A successful service message. public IServiceMessage Successful(params Enum[] messages) => CreateMessage(true, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service message using enumeration messages. /// @@ -157,6 +179,7 @@ namespace DigitalData.Core.Application /// A failed service message. public IServiceMessage Failed(params Enum[] messages) => CreateMessage(false, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a successful service result with the provided data using enumeration messages. /// @@ -166,6 +189,7 @@ namespace DigitalData.Core.Application /// A successful service result containing the specified data. public IServiceResult Successful(T data, params Enum[] messages) => CreateResult(data, true, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service result, optionally including data, using enumeration messages. /// @@ -175,6 +199,7 @@ namespace DigitalData.Core.Application /// A failed service result, which may or may not contain the specified data. public IServiceResult Failed(T? data = default, params Enum[] messages) => CreateResult(data, false, messages.Select(m => m.ToString()).ToArray()); + [Obsolete("Deprecated: Use ClientMessages instead.")] /// /// Creates a failed service result using only failure messages, without explicitly including data. /// diff --git a/DigitalData.Core.Application/ServiceBase.cs b/DigitalData.Core.Application/ServiceBase.cs index bcb44ca..0fef1b9 100644 --- a/DigitalData.Core.Application/ServiceBase.cs +++ b/DigitalData.Core.Application/ServiceBase.cs @@ -1,31 +1,16 @@ using AutoMapper; using DigitalData.Core.Contracts.Application; +using DigitalData.Core.Contracts.CultureServices; namespace DigitalData.Core.Application { /// - /// Provides a base implementation of , offering basic service messaging and result creation functionalities. + /// Provides a base implementation of . /// public class ServiceBase : ResponseService, IServiceBase, IResponseService { - - } - - public static class AutoMapperExtension - { - /// - /// Maps a source object to a destination object, or throws an exception if the mapping result is null. - /// - /// The source object type. - /// The destination object type. - /// The source object to map from. - /// The mapped destination object. - /// Thrown when the mapping result is null. - public static TDestination MapOrThrow(this IMapper mapper, object source) + public ServiceBase(IKeyTranslationService translationService) : base(translationService) { - return mapper.Map(source) ?? throw new AutoMapperMappingException( - $"Mapping to {typeof(TDestination).FullName} resulted in a null object. " + - "Hint: Ensure that the AutoMapper profile configuration for this mapping is correct."); } } } \ No newline at end of file diff --git a/DigitalData.Core.Application/ServiceMessage.cs b/DigitalData.Core.Application/ServiceMessage.cs index 6192709..e355044 100644 --- a/DigitalData.Core.Application/ServiceMessage.cs +++ b/DigitalData.Core.Application/ServiceMessage.cs @@ -1,40 +1,113 @@ using DigitalData.Core.Contracts.Application; +using System.Text.Json.Serialization; namespace DigitalData.Core.Application { /// - /// Represents the outcome of a service operation, encapsulating the success or failure status, - /// and any associated messages. + /// Represents the outcome of a service operation, encapsulating the success or failure status, + /// and any associated messages. It also supports optional translation of message keys for localization purposes. /// public class ServiceMessage : IServiceMessage { + /// + /// Initializes a new instance of the ServiceMessage class. + /// + public ServiceMessage() + { + } + + /// + /// Initializes a new instance of the ServiceMessage class, specifying the success status. + /// Optionally, a function for translating message keys can be provided. + /// If a translation function is provided, it will be used for both string and enum message keys. + /// + /// Indicates whether the service operation was successful. + /// If provided, it will also be adapted for translating enum keys by converting them to strings first. + [Obsolete("Deprecated: initialize objects using object initializer.")] + public ServiceMessage(bool isSuccess) + { + IsSuccess = isSuccess; + } + /// /// Initializes a new instance of the ServiceMessage class with specified success status, and messages. /// /// Indicates whether the service operation was successful. - /// The data associated with a successful operation. /// An array of messages related to the operation's outcome. + [Obsolete("Deprecated: initialize objects using object initializer.")] public ServiceMessage(bool isSuccess, params string[] messages) { IsSuccess = isSuccess; Messages = messages.ToList(); } - + /// /// Gets or sets a value indicating whether the service operation was successful. /// - public bool IsSuccess { get; set; } + public bool IsSuccess { get; set; } = false; /// - /// Gets or sets a collection of messages associated with the service operation. + /// [Obsolete("Deprecated: Use ClientMessages instead.")] + /// Gets a collection of messages associated with the service operation. These messages can be error descriptions, + /// success notifications, or other relevant information related to the operation's outcome. /// - public List Messages { get; set; } = new List(); + [Obsolete("Deprecated: Use ClientMessages instead.")] + public List Messages { get; init; } = new(); + + /// + /// Gets a collection of messages intended for client display. This replaces the deprecated 'Messages' property. + /// + public List ClientMessages { get; init; } = new(); + + /// + /// Gets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed. + /// + [JsonIgnore] + public List TraceMessages { get; init; } = new(); + + /// + /// Gets a collection of messages helpful for debugging during development. These messages are often diagnostic. + /// + [JsonIgnore] + public List DebugMessages { get; init; } = new(); + + /// + /// Gets a collection of informational messages, less critical than warnings, generally used for non-critical notifications. + /// + [JsonIgnore] + public List InformationMessages { get; init; } = new(); + + /// + /// Gets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention. + /// + [JsonIgnore] + public List WarningMessages { get; init; } = new(); + + /// + /// Gets a collection of error messages indicating failures or problems within the service. + /// + [JsonIgnore] + public List ErrorMessages { get; init; } = new(); + + /// + /// Gets a collection of messages indicating critical issues that require immediate attention. + /// + [JsonIgnore] + public List CriticalMessages { get; init; } = new(); + + /// + /// A function that translates a message key from a string to its localized or transformed representation. + /// This property allows for custom translation logic to be applied based on the application's needs. + /// + [JsonIgnore] + public Func KeyTranslator { get; init; } = key => key; /// /// Adds a new message to the collection of messages associated with the service operation. /// /// The message to add. /// The current instance of ServiceMessage, allowing for method chaining. + [Obsolete("Deprecated: Use ClientMessages instead.")] public IServiceMessage WithMessage(string message) { Messages.Add(message); @@ -47,6 +120,7 @@ namespace DigitalData.Core.Application /// /// The enum value representing the message key. /// The current instance of ServiceMessage, allowing for method chaining. + [Obsolete("Deprecated: Use ClientMessages instead.")] public IServiceMessage WithMessageKey(Enum messageKey) { Messages.Add(messageKey.ToString()); diff --git a/DigitalData.Core.Application/ServiceMessageExtensions.cs b/DigitalData.Core.Application/ServiceMessageExtensions.cs new file mode 100644 index 0000000..8064a28 --- /dev/null +++ b/DigitalData.Core.Application/ServiceMessageExtensions.cs @@ -0,0 +1,169 @@ +using DigitalData.Core.Contracts.Application; + +namespace DigitalData.Core.Application +{ + /// + /// Provides extension methods for IServiceMessage to enhance the usability of service messages + /// by allowing easy addition of various types of messages including client, trace, debug, information, + /// warning, error, and critical messages. These methods support both direct messages and enum-based keys + /// for messages, facilitating localized or custom-formatted messages. + /// + public static class ServiceMessageExtensions + { + #region ClientMessage + /// + /// Adds a single client message to the service message. + /// + /// The service message to modify. + /// The message to add. + /// The modified service message instance. + public static T WithClientMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.ClientMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds a client message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the message. + /// The modified service message instance. + public static T WithClientMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithClientMessage(message); + } + #endregion + + #region TraceMessages + /// + /// Adds a trace message to the service message. + /// + /// The service message to modify. + /// The trace message to add. + /// The modified service message instance. + public static T WithTraceMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.TraceMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds a trace message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the trace message. + /// The modified service message instance. + public static T WithTraceMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithTraceMessage(message); + } + #endregion + + #region DebugMessages + /// + /// Adds a debug message to the service message. + /// + /// The service message to modify. + /// The debug message to add. + /// The modified service message instance. + public static T WithDebugMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.DebugMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds a debug message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the debug message. + /// The modified service message instance. + public static T WithDebugMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithDebugMessage(message); + } + #endregion + + #region WarningMessages + /// + /// Adds a warning message to the service message. + /// + /// The service message to modify. + /// The warning message to add. + /// The modified service message instance. + public static T WithWarningMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.WarningMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds a warning message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the warning message. + /// The modified service message instance. + public static T WithWarningMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithWarningMessage(message); + } + #endregion + + #region ErrorMessages + /// + /// Adds an error message to the service message. + /// + /// The service message to modify. + /// The error message to add. + /// The modified service message instance. + public static T WithErrorMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.ErrorMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds an error message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the error message. + /// The modified service message instance. + public static T WithErrorMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithErrorMessage(message); + } + #endregion + + #region CriticalMessages + /// + /// Adds a critical message to the service message. + /// + /// The service message to modify. + /// The critical message to add. + /// The modified service message instance. + public static T WithCriticalMessage(this T serviceMessage, string message) where T : IServiceMessage + { + serviceMessage.CriticalMessages.Add(message); + return serviceMessage; + } + + /// + /// Adds a critical message based on an enumeration key to the service message. + /// + /// The service message to modify. + /// The enum key representing the critical message. + /// The modified service message instance. + public static T WithCriticalMessageKey(this T serviceMessage, Enum messageKey) where T : IServiceMessage + { + var message = serviceMessage.KeyTranslator(messageKey.ToString()); + return serviceMessage.WithCriticalMessage(message); + } + #endregion + } +} \ No newline at end of file diff --git a/DigitalData.Core.Application/ServiceResult.cs b/DigitalData.Core.Application/ServiceResult.cs index bc1ddd4..1f3ad81 100644 --- a/DigitalData.Core.Application/ServiceResult.cs +++ b/DigitalData.Core.Application/ServiceResult.cs @@ -9,17 +9,47 @@ namespace DigitalData.Core.Application /// The type of data returned by the service operation, if any. public class ServiceResult : ServiceMessage, IServiceResult { + /// + /// Initializes a new instance of the ServiceResult class. + public ServiceResult() + { + } + + /// + /// Initializes a new instance of the ServiceResult class, specifying the success status is false and data. + /// Optionally, a function for translating message keys can be provided. + /// If a translation function is provided, it will be used for both string and enum message keys. + /// + /// The data associated with a successful operation. + /// A function that translates a string key into its localized representation. + /// If provided, it will also be adapted for translating enum keys by converting them to strings first. + [Obsolete("Deprecated: initialize objects using object initializers instead.")] + public ServiceResult(T? data) + { + Data = data; + IsSuccess = false; + } + + /// + /// Initializes a new instance of the ServiceResult class with specified success status and data. + /// + /// The data associated with a successful operation. + /// Indicates whether the service operation was successful. + [Obsolete("Deprecated: initialize objects using object initializers instead.")] + public ServiceResult(T? data, bool isSuccess) : base(isSuccess) => Data = data; + /// /// Initializes a new instance of the ServiceResult class with specified success status, data, and messages. /// /// The data associated with a successful operation. /// Indicates whether the service operation was successful. /// An array of messages related to the operation's outcome. + [Obsolete("Deprecated: Use ClientMessages instead.")] public ServiceResult(T? data, bool isSuccess, params string[] messages) : base(isSuccess, messages) => Data = data; /// /// Gets or sets the data resulting from the service operation. /// - public T? Data { get; set; } + public T? Data { get; set; } = default; } } \ No newline at end of file diff --git a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.dll b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.dll index 78916dc..4abab97 100644 Binary files a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.dll and b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.dll differ diff --git a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.pdb b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.pdb index 50443aa..db723a1 100644 Binary files a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.pdb and b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Application.pdb differ diff --git a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.dll b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.dll index 9c30b51..b2f6929 100644 Binary files a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb index 1c7b29a..a2e6ca4 100644 Binary files a/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb and b/DigitalData.Core.Application/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb differ diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache index 930a9a6..dbd4edc 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache and b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.AssemblyReference.cache differ diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.CoreCompileInputs.cache b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.CoreCompileInputs.cache index 385b9e1..c0d4346 100644 --- a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.CoreCompileInputs.cache +++ b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3640b57401dc921b27e40c7f798bc080351d913f +1204f54a36145ece1945026f8fb6c0371ee8b734 diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.dll b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.dll index 78916dc..4abab97 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.dll and b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.dll differ diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.pdb b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.pdb index 50443aa..db723a1 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.pdb and b/DigitalData.Core.Application/obj/Debug/net7.0/DigitalData.Core.Application.pdb differ diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/ref/DigitalData.Core.Application.dll b/DigitalData.Core.Application/obj/Debug/net7.0/ref/DigitalData.Core.Application.dll index 82887dd..2b5900f 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/ref/DigitalData.Core.Application.dll and b/DigitalData.Core.Application/obj/Debug/net7.0/ref/DigitalData.Core.Application.dll differ diff --git a/DigitalData.Core.Application/obj/Debug/net7.0/refint/DigitalData.Core.Application.dll b/DigitalData.Core.Application/obj/Debug/net7.0/refint/DigitalData.Core.Application.dll index 82887dd..2b5900f 100644 Binary files a/DigitalData.Core.Application/obj/Debug/net7.0/refint/DigitalData.Core.Application.dll and b/DigitalData.Core.Application/obj/Debug/net7.0/refint/DigitalData.Core.Application.dll differ diff --git a/DigitalData.Core.Contracts/Application/IServiceMessage.cs b/DigitalData.Core.Contracts/Application/IServiceMessage.cs index 6a6af1d..b947459 100644 --- a/DigitalData.Core.Contracts/Application/IServiceMessage.cs +++ b/DigitalData.Core.Contracts/Application/IServiceMessage.cs @@ -5,62 +5,70 @@ namespace DigitalData.Core.Contracts.Application /// /// Defines a structured format for service messages, categorizing them into success indicators and various types of messages. /// This interface segregates messages into client-facing messages and different levels of logging messages, facilitating targeted communications and diagnostics. + /// Properties are initialized once per instance and cannot be modified afterwards, promoting immutability. /// public interface IServiceMessage { /// - /// Gets or sets a flag indicating whether the service operation was successful. + /// Gets or sets a value indicating whether the service operation was successful. /// bool IsSuccess { get; set; } - /// - /// Gets or sets a collection of messages intended for client display. This is intended to replace the deprecated 'Messages' property. - /// - List ClientMessages { get; set; } - /// /// [Obsolete("Deprecated: Use ClientMessages instead.")] - /// Gets or sets a collection of messages associated with the service operation. These messages can be error descriptions, + /// Gets a collection of messages associated with the service operation. These messages can be error descriptions, /// success notifications, or other relevant information related to the operation's outcome. /// [Obsolete("Deprecated: Use ClientMessages instead.")] - List Messages { get; set; } + List Messages { get; init; } /// - /// Gets or sets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed. + /// Gets a collection of messages intended for client display. This replaces the deprecated 'Messages' property. /// - [JsonIgnore] - List TraceMessages { get; set; } + List ClientMessages { get; init; } /// - /// Gets or sets a collection of messages helpful for debugging during development. These messages are often diagnostic. + /// Gets a collection of messages used for tracing program execution at a fine-grained level. These are typically voluminous and detailed. /// [JsonIgnore] - List DebugMessages { get; set; } + List TraceMessages { get; init; } /// - /// Gets or sets a collection of informational messages, less critical than warnings, generally used for non-critical notifications. + /// Gets a collection of messages helpful for debugging during development. These messages are often diagnostic. /// [JsonIgnore] - List InformationMessages { get; set; } + List DebugMessages { get; init; } /// - /// Gets or sets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention. + /// Gets a collection of informational messages, less critical than warnings, generally used for non-critical notifications. /// [JsonIgnore] - List WarningMessages { get; set; } + List InformationMessages { get; init; } /// - /// Gets or sets a collection of error messages indicating failures or problems within the service. + /// Gets a collection of messages indicating potential issues that are not necessarily errors, but which may require attention. /// [JsonIgnore] - List ErrorMessages { get; set; } + List WarningMessages { get; init; } /// - /// Gets or sets a collection of messages indicating critical issues that require immediate attention. + /// Gets a collection of error messages indicating failures or problems within the service. /// [JsonIgnore] - List CriticalMessages { get; set; } + List ErrorMessages { get; init; } + + /// + /// Gets a collection of messages indicating critical issues that require immediate attention. + /// + [JsonIgnore] + List CriticalMessages { get; init; } + + /// + /// A function that translates a message key from a string to its localized or transformed representation. + /// This property allows for custom translation logic to be applied based on the application's needs. + /// + [JsonIgnore] + public Func KeyTranslator { get; init; } /// /// Adds a new message to the appropriate collection based on the message type. diff --git a/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.dll b/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.dll index 9c30b51..b2f6929 100644 Binary files a/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb b/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb index 1c7b29a..a2e6ca4 100644 Binary files a/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb and b/DigitalData.Core.Contracts/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb differ diff --git a/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.dll b/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.dll index 9c30b51..b2f6929 100644 Binary files a/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.pdb b/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.pdb index 1c7b29a..a2e6ca4 100644 Binary files a/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.pdb and b/DigitalData.Core.Contracts/obj/Debug/net7.0/DigitalData.Core.Contracts.pdb differ diff --git a/DigitalData.Core.Contracts/obj/Debug/net7.0/ref/DigitalData.Core.Contracts.dll b/DigitalData.Core.Contracts/obj/Debug/net7.0/ref/DigitalData.Core.Contracts.dll index cc1d723..b627059 100644 Binary files a/DigitalData.Core.Contracts/obj/Debug/net7.0/ref/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Contracts/obj/Debug/net7.0/ref/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.Contracts/obj/Debug/net7.0/refint/DigitalData.Core.Contracts.dll b/DigitalData.Core.Contracts/obj/Debug/net7.0/refint/DigitalData.Core.Contracts.dll index cc1d723..b627059 100644 Binary files a/DigitalData.Core.Contracts/obj/Debug/net7.0/refint/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Contracts/obj/Debug/net7.0/refint/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.dll b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.dll index 9c30b51..b2f6929 100644 Binary files a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.dll and b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb index 1c7b29a..a2e6ca4 100644 Binary files a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb and b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb differ diff --git a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.dll b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.dll index e5d8377..abddca6 100644 Binary files a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.dll and b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.dll differ diff --git a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.pdb b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.pdb index 08876e3..83fece5 100644 Binary files a/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.pdb and b/DigitalData.Core.CultureServices/bin/Debug/net7.0/DigitalData.Core.CultureServices.pdb differ diff --git a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache index 7d27913..a928ab3 100644 Binary files a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache and b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.csproj.AssemblyReference.cache differ diff --git a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.dll b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.dll index e5d8377..abddca6 100644 Binary files a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.dll and b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.dll differ diff --git a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.pdb b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.pdb index 08876e3..83fece5 100644 Binary files a/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.pdb and b/DigitalData.Core.CultureServices/obj/Debug/net7.0/DigitalData.Core.CultureServices.pdb differ diff --git a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.dll b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.dll index 9c30b51..b2f6929 100644 Binary files a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.dll and b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.dll differ diff --git a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb index 1c7b29a..a2e6ca4 100644 Binary files a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb and b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Contracts.pdb differ diff --git a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.dll b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.dll index 7e103c9..7fa5d64 100644 Binary files a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.dll and b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.dll differ diff --git a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.pdb b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.pdb index c99b3e4..de15ccc 100644 Binary files a/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.pdb and b/DigitalData.Core.Infrastructure/bin/Debug/net7.0/DigitalData.Core.Infrastructure.pdb differ diff --git a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache index 1e9e175..5a5e23f 100644 Binary files a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache and b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.csproj.AssemblyReference.cache differ diff --git a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.dll b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.dll index 7e103c9..7fa5d64 100644 Binary files a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.dll and b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.dll differ diff --git a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.pdb b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.pdb index c99b3e4..de15ccc 100644 Binary files a/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.pdb and b/DigitalData.Core.Infrastructure/obj/Debug/net7.0/DigitalData.Core.Infrastructure.pdb differ