I wrote this attribute extension:
public class LocalizedRequiredAttribute : RequiredAttribute
{
public LocalizedRequiredAttribute(string resourceTag)
{
ErrorMessage = GetMessageFromResource(resourceTag);
}
private static String GetMessageFromResource(String resourceTag)
{
return ResourceManager.Current.GetResourceString(resourceTag);
}
}
but I get this error: ‘System.Resources.ResourceManager’ does not contain a definition for ‘Current’.
What is wrong?
Thanks a lot.
This can already be done using the RequiredAttribute
see Model Metadata and Validation Localization using Conventions
EDIT:
I Guess you’re referencing the wrong ResourceManager, see ResourceManager.Current | current property