I have:
- a Dto.Library (.Net 5 Library)
- a SharedResourceLibrary with Resource.resx (.Net 5 Library)
How can i use the Resource File Messages in conjunction with Data Annotation in my DTO.Library?
The ErrorMessage should be the text from the resx files:
public class MeterForCreationDto
{
[Required(ErrorMessage = "Name must not be empty!")]
public string Name { get; set; }
[Required(ErrorMessage = "Unit must not be empty!")]
public string Unit { get; set; }
}
SharedResourceLibrary: looks like this answer @Shiran Dror