I am trying to the following thing:
[Display(Name = Resources.LcmsBs.Models.UserName)]
[ToolTip(Resources.LcmsBs.ToolTips.UserName)]
public string UserName { get; set; }
I am getting the following compilation error :
An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
What is the best practice to avoid hard coded constants in code ? Is it possible to set attributes values from the resources ?
You've got a slightly different question but the answer to the following could be applied to your question
DataAnnotations and Resources don't play nicely
Something like the following
[Display(ResourceType = typeof(Resources.LcmsBs.Models), Name = "UserName")]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With