i have a class the sales and product, which have the same declaration of object, these two class is auto generated by the server, all i want is set the annotation of them so that it can be reusable all the time, how can i set the MetadataType of this two into one,
From Sales
public partial class Sales
{
public string Currency { get; set;}
}
From Product
public partial class Product
{
public string Currency { get; set;}
}
namespace Validation.Access
{
[MetadataType(typeof(TransferModuleValidation))]
public partial class Product { }
public partial class TransferModuleValidation
{
[MaxLength(3, ErrorMessage = "Must be less than or 3 characters")]
public string Currency { get; set;
}
}
how can i set Sales in that example? do i have to inherit class (Product) to Sales?