I have an auto generated class with a property on it. I want to add some data annotations to that property in another partial class of the same type. How would I do that?<
Looks like I figured out a different way similar to the link above using MetadataTypeAttribute:
namespace MyApp.BusinessObjects
{
[MetadataTypeAttribute(typeof(SomeClass.Metadata))]{
public partial class SomeClass
{
internal sealed class Metadata
{
private Metadata()
{
}
[Required]
public string Name{ get; set; }
}
}
}