DamianEdwards / MiniValidation

A minimalist validation library for .NET built atop the existing features in `System.ComponentModel.DataAnnotations` namespace
MIT License
337 stars 27 forks source link

Move GetDisplayName out of cache to support localization #23

Closed marcominerva closed 2 years ago

marcominerva commented 2 years ago

The current implementation of the GetDisplayName method in src/MiniValidation/TypeDetailsCache.cs puts the display name inside the cache. This is an issue because, if we make requests with different culture, the ResourceManager isn't used anymore and so we always get the localized display name corresponding to the language of the first request.

This PR moves GetDisplayName out of TypeDetailsCache.cs, so the the display name is retrieved for every request, solving the localization problem.

DamianEdwards commented 2 years ago

Available in https://github.com/DamianEdwards/MiniValidation/releases/tag/v0.4.2-pre.20220306.48