use Data Annotation to my Linq to SQL
- by Khalid Omar
i have a mvc web project and i'm using linq to sql
i'm using dataannotaion like this
public class ClientValidation
{
[Required]
public string name1st { get; set; }
}
then in the linq class i add that above client class
[global::System.Data.Linq.Mapping.TableAttribute(Name = "dbo.Client")]
[MetadataType(typeof(ClientValidation))]
public partial class Client : INotifyPropertyChanging, INotifyPropertyChanged
{
}
every thing is going ok
the question is when i re generate the linq when i add table or change any thing in database i need to rewrite [MetadataType(typeof(ClientValidation))]
is there any other method to enable me regenerate the model and keep the data annotation as it