Skip to content

Commit

Permalink
fix warning ef: No store type was specified for the decimal property (#…
Browse files Browse the repository at this point in the history
…1009)

* fix warning ef: No store type was specified for the decimal property
  • Loading branch information
thiennn committed Oct 23, 2021
1 parent f2d94f0 commit 2bbdcde
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Modules/SimplCommerce.Module.Core/Data/SimplDbContext.cs
Expand Up @@ -49,6 +49,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

RegisterCustomMappings(modelBuilder, typeToRegisters);

foreach (var property in modelBuilder.Model.GetEntityTypes()
.SelectMany(t => t.GetProperties())
.Where(p => p.ClrType == typeof(decimal) || p.ClrType == typeof(decimal?)))
{
property.SetColumnType("decimal(18,2)");
}

if (Database.ProviderName == "Microsoft.EntityFrameworkCore.Sqlite")
{
// SQLite does not have proper support for DateTimeOffset via Entity Framework Core, see the limitations
Expand Down

0 comments on commit 2bbdcde

Please sign in to comment.