Open bluekms opened 2 years ago
Maybe it's a snapshot issue. Is there any way to fix that?
@bluekms the official Microsoft tutorial uses SQL Server LocalDB engine which supports 'money' type (which looks like alias for decimal type). There is no money type in MySQL and MariaDB and that's why there is no such support in Pomelo. Maybe it will be good for Pomelo to detect DataType(DataType.Currency)]
attribute and automatically convert such types to decimal.
To make it work for you:
1) Remove [DataType(DataType.Currency)]
2) Remove [Column(TypeName = "money")]
or replace it with [Column(TypeName = "decimal(18,2)")]
. Check the official MySQL guide for decimal precision and scale (18 and 2 in my case) https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html
Steps to reproduce
Tutorial: Create a complex data model - ASP.NET MVC with EF Core I am learning the official tutorial.
The issue
original source code
my source code 1
my source code 2
original source code, my1, my2 They all produce the same code.
Further technical details
MySQL version: 8.0.28 Operating system: windows 10 Pomelo.EntityFrameworkCore.MySql version: 6.0.1 Pomelo.EntityFrameworkCore.MySql.Design : 1.1.2 Microsoft.EntityFrameworkCore : 6.0.6 Microsoft.EntityFrameworkCore.Design : 6.0.1