I've spent two days scouring the internet for what I'm doing wrong. Every tutorial and question/answer here shows the same solution :
[MetadataType(typeof(PEOPLE_Metadata))]
public partial class PEOPLE { }
public class PEOPLE_Metadata
{
[DisplayName("Social Security Number")]
public string SSN { get; set; }
}
The problem is that this isn't working for me. When I crawl through the properties for the PEOPLE class in my view, the SSN property shows no attributes nor customattributes. I can see that the PEOPLE class has the MetadataType attribute. I've tried separating the classes into separate files, the same file, the metadata class inside the partial, the two separate, setting the metadata class to partial, internal, sealed, public, everything. I have literally no idea why this isn't working for me, when by all accounts it ought to.
Please help me.
The PEOPLE class is as below :
public partial class PEOPLE
{
public int ID { get; set; }
public string SSN { get; set; }
public string NAME { get; set; }
}
It may be worth emphasizing that I'm trying to see the metadata attributes of the properties through reflection. More research showed me how to pull out the metadata attribute and then reflect into the metadata class, PEOPLE_Metadata, but I'd really prefer minimizing the amount of reflection crawling being done.