I am looking through the framework of asp.net mvc 2.0 and it seems like it is putting its annotation tags on the classes that also generate linq for 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 will happen if I do not design my database in this way. What happens if I just add to my solution the linqtosql.dbml (linq to sql class) file where I get this beautiful designer.
Where would I put all these data annotations, would I make another class in which all this content will be? Or maybe in viewing models?
source
share