dotnet / dotnet/efcore

Don't warn for decimal mappings in keyless entity types and tables without triggers

Open
#27,438 2 comments 4 reactions 1 assignee Assigned to @AndriySvyryd View on GitHub
area-type-mapping customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Why is this warning triggered for decimals in entities with keyless tag as they are not in the database?

` No store type was specified for the decimal property '{property}' on entity type '{entityType}'. 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 in 'OnModelCreating' using 'HasColumnType', specify precision and scale using 'HasPrecision', or configure a value converter using 'HasConversion'.
`

_From: https://github.com/dotnet/efcore/blob/main/src/EFCore.SqlServer/Properties/SqlServerStrings.Designer.cs_

It doesn't make sense to have a precision when using keyless entities to retrieve data from views in the database:

`db.Set().FromSqlInterpolated($"SELECT * FROM dbo.GetKET({date},{cateory})").ToArray();`

Hence on a large project the number of warnings is so big that it takes time to print them all individually.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.