You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Domain objects or dtos can implement ICustomValidate to implement complex validation logic. See documentation.
The CustomValidatationContext provides no easy way to translate validation-messages. Localized validation messages are crucial for a good user-experience.
One could resolve ILocalizationManager as a workaround, as CustomValidatationContext exposes an IocResolver.
But this adds an implicit dependency on ILocalizationManager (Service Locator antipattern). Probably an interception of the validation chain could be the solution to this. In the Dto I would only provide the key (and probably additional parameters) to the localized text. This could be done by inheriting from ValidationResult.
An other (easier) way would be to expose a localization method directly in the CustomValidatationContext.
The text was updated successfully, but these errors were encountered:
Domain objects or dtos can implement
ICustomValidate
to implement complex validation logic. See documentation.The
CustomValidatationContext
provides no easy way to translate validation-messages. Localized validation messages are crucial for a good user-experience.One could resolve
ILocalizationManager
as a workaround, asCustomValidatationContext
exposes anIocResolver
.But this adds an implicit dependency on ILocalizationManager (Service Locator antipattern). Probably an interception of the validation chain could be the solution to this. In the Dto I would only provide the key (and probably additional parameters) to the localized text. This could be done by inheriting from ValidationResult.
An other (easier) way would be to expose a localization method directly in the
CustomValidatationContext
.The text was updated successfully, but these errors were encountered: