EF Core with Mysql not scaffolding BIT(1) to Boolean

.net-core c# entity-framework-core mysql

Question

I am trying to generate DB classes from the existing database (DB first) through. Net core CLI.

The DB was perfectly working with EF5 and .net4.5 but after migrate to EF core the bit(1) field is not scaffolding as bool instead it is generating as short.

Also tried with TinyInt(1) but no luck.

Technology Stack - .Net core - 2.2 MySql.Data.EntityFrameworkCore (8.0.15) MySQl Connector Net 8.0.13 innodb_version 8.0.13

1
1
4/3/2019 9:08:59 AM

Popular Answer

First you need to add this packages from Nuget:
MySql.Data.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Design
then run this command :

Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=sakila" MySql.Data.EntityFrameworkCore -OutputDir model -f

if this solution still not working try this solution : https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql

3
4/3/2019 9:39:47 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow