I have some interface and classes
public inteface IRole
{
int Id { get; }
string Name { get; set; }
}
public class Role : IRole
{
public int Id { get; }
[Display("Role Name")]
public string Name { get; set; }
}
public class Member
{
[Display("Login")]
public string Login { get; set; }
[Display("Password")]
public string Password { get; set; }
public IRole Role { get; set; }
}
on View I try to use, View is strongly type of Member
on this line displays correct message from DisplayAttribute
<%= Html.LabelFor(m => m.Login) %>
on this line it does not display correct label from DisplayAttribute
<%= Html.LabelFor(m => m.Role.Name) %>
How can I fix this to have correct labels in such architecture?
Thanks
P.S. I know about adding DisplayAttribute to the interface field and all will work, but maybe there are different solution.