Skip to main content
Jagdish Kumawat
Founder @ Dewiride
View all authors

Fixed: "The migration 'AddProductVersion' was not found." with dotnet ef --no-build

· 5 min read
Jagdish Kumawat
Founder @ Dewiride

I created a migration, and the very next command said The migration 'AddProductVersion' was not found. The file was right there in the Migrations folder. The cause was a flag I'd added to save a few seconds: --no-build makes the EF Core tools use the last compiled DLL, and that DLL was older than the migration.

Fixed: MySQL Rounds a Decimal Like 9.999 to 10.00 Without an Error (Note 1265: Data truncated for column)

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

I sent a product price of 9.999 to my API, and it answered 201 Created with a price of 10.00. No error, no warning: MySQL rounded the amount to fit its DECIMAL(12,2) column, even in strict mode, and raised only a note that EF Core never shows. For money, silently changing the number isn't acceptable, so the API now refuses it.

Fixed: "Data too long for column 'Name' at row 1" When Saving with EF Core and MySQL

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

A long category name made my API answer 500, with Data too long for column 'Name' at row 1 in the log. MySQL was right to refuse it: the column is varchar(100), and the name had 101 characters. The problem was that the request got as far as MySQL at all. A validation attribute stops it first, and the client gets an answer it can act on.

Fixed: "Unknown column 'p.Version' in 'field list'" with EF Core and MySQL

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

Right after I added a property to an EF Core entity, every request that touched that table answered 500, and the log said MySqlException: Unknown column 'p.Version' in 'field list'. The code built without a problem, because the C# was fine. The table simply didn't have that column yet: changing the class doesn't change the database until a migration does.

How to Connect a .NET C# Web API to a MySQL Database — Part 2: Create MySQL Tables with EF Core Migrations

· 45 min read
Jagdish Kumawat
Founder @ Dewiride

Part 1 connected a .NET C# Web API to MySQL, but the database is still empty. This part describes the inventory data as C# classes and lets EF Core migrations create the matching MySQL tables, with the column types, keys, indexes and constraints you'd otherwise write by hand. You'll read the SQL before it runs, apply it, change the model and add a second migration, and then check every table from inside MySQL.