I have a column inside my sql server 2008 wih type of Decimal(18,2). But on entity framework what is the best data annotation validation I can apply to this pro
For a different approach which some may consider more readable, you can override the OnModelCreating method of your DbContext to set precision, like so:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity()
.Property(x => x.TheProprty)
.HasPrecision(18, 2);
}
Advantage: strongly typed vs custom regular expression
Disadvantage: can't see it on the class with just a scan