For example, consider the Invoice class:
public class Invoice { public int InvoiceId { get; set; } public decimal Amount { get; set; } }
You can do this using the free API:
protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<Invoice>() .Property(i => i.Amount) .HasColumnType("Money"); }
Or you can do this with data annotations:
public class Invoice { public int InvoiceId { get; set; } [Column(TypeName="Money")] public decimal Amount { get; set; } }
Morteza Manavi Jan 28 '11 at 10:01 2011-01-28 22:01
source share