This one works great
[MetadataType(typeof(Area_Validation))]
public partial class Area
{
...
}
public class Area_Validation
{
[Required(ErrorMessage = "Please add this field.")]
public int Email { get; set; }
[Required(ErrorMessage = "Please add this field")]
public string Name { get; set; }
}
but what about if Area_Validationdynamically created? for example, the subscription fields that can be created by the user on the internal server and end as follows:

How to set metadata in each field for automatic verification ?
I am currently doing:
public class SubscriberFormViewModel
{
public List<SubscriberFieldModel> Fields { get; private set; }
public Calendar Calendar { get; private set; }
public Company Company { get; private set; }
public SubscriberFormViewModel()
{
}
public SubscriberFormViewModel(Decimal calendarId)
{
if (calendarId > 0)
{
SubscribersRepository db = new SubscribersRepository();
Calendar calendar = db.GetCalendarById(calendarId);
Company company = db.GetCompanyById(calendar.company_id);
this.Fields = db.FindAllSubscriberFieldsByCalendar(calendarId);
this.Calendar = calendar;
this.Company = company;
}
else
this.Fields = new List<SubscriberFieldModel>();
}
}
and I want to set Metadata in the whole propertyFields
In other words, this Fieldsis filled from the database and can have several types may be string, number, dropdownetc .... kind of like MailChimp field properties:

programmaticaly jQuery MVC2?