use Data Annotation to my Linq to SQL

Posted by Khalid Omar on Stack Overflow See other posts from Stack Overflow or by Khalid Omar
Published on 2010-12-30T08:25:10Z Indexed on 2010/12/30 8:55 UTC
Read the original article Hit count: 417

Filed under:
|
|
|

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

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-sql