If I have a dbml file that contains say a Customer class with say a single property of CompanyName;
public partial class Customer : INotifyPropertyChanging, INotifyPropertyChanged
private string _CompanyName;
public string CompanyName
{
get
Now, given that the above is in a dbml and thus generated I obviously should avoid editing it like the plague.
So I have created another class like so;
public partial class Customer
{
[Required]
public string CompanyName{get;set;}
}
The reason for this is because I want to decorate my field as being required.
However this doesn't work as I get the compile error "...already contains a definition for 'CustomerID'".
Does anyone know a way around this or is there a better way to mark fields as required or of validating a model?