0

I have been using the following property in my entity

public decimal smallamount { get; set; }

It persists to a SQL Server column of type smallmoney.

I get a warning

No type was specified for the decimal column "smallamount" on entity type jobline.

This will cause values to be silently truncated if they do not fit in the default precision and scale.

Explicitly specify the SQL Server column type that can accommodate all the values using 'ForHasColumnType()'.

I gather I can use a column attribute

For example

[Column(TypeName = "decimal(10, 2)")]

Or alternatively use the modelbuilder HasPrecision property.

But where can I find out what precision I should use?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Kirsten
  • 15,730
  • 41
  • 179
  • 318
  • https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings – Kirsten Mar 05 '19 at 05:17
  • https://learn.microsoft.com/en-us/sql/t-sql/data-types/money-and-smallmoney-transact-sql?view=sql-server-2017 – Kirsten Mar 05 '19 at 05:23
  • https://stackoverflow.com/questions/582797/should-you-choose-the-money-or-decimalx-y-datatypes-in-sql-server – Kirsten Mar 05 '19 at 05:25

0 Answers0