I am going through pro asp.net mvc 2.0 framework and it seems that he puts his data annotation tags on classes that also generate the linq to sql.
[Table(Name = "Products")]
public class Product
{
[HiddenInput(DisplayValue = false)]
[Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
public int ProductID { get; set; }
[Required(ErrorMessage = "Please enter a product name")]
[Column] public string Name { get; set; }
[Required(ErrorMessage = "Please enter a description")]
[DataType(DataType.MultilineText)]
[Column] public string Description { get; set; }
[Required]
[Range(0.01, double.MaxValue, ErrorMessage = "Please enter a positive price")]
[Column] public decimal Price { get; set; }
[Required(ErrorMessage = "Please specify a category")]
[Column] public string Category { get; set; }
[Column]
public byte[] ImageData { get; set; }
[ScaffoldColumn(false)] [Column]
public string ImageMimeType { get; set; }
However I am wondering what happens if I don't develop my database this way. What happens if I just add to my solution a linqtosql.dbml ( linq to sql class) file where I get that nice designer.
Where would I put all these data annotations would I make another class what would have all this content in? Or maybe in the view models?