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

情到浓时终转凉″ 提交于 2019-12-24 06:49:38

问题


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:


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



来源:https://stackoverflow.com/questions/55491298/ef-core-with-mysql-not-scaffolding-bit1-to-boolean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!