Base solution for your next web application
Open Closed

Linux + mysql = No coercion operator is defined between types 'System.Int16' and 'System.Boolean' #6063


User avatar
0
commondesk created

We are trying to use a MySql database as described on this article

https://aspnetboilerplate.com/Pages/Documents/EF-Core-MySql-Integration

After following the steps on the article, we are able to build and deploy our app pointing to a mysql database server

However, when the application starts, we get this error

System.InvalidOperationException: No coercion operator is defined between types 'System.Int16' and 'System.Boolean'

This is caused by this line on method DefaultEditionCreator.CreateEditions()

context.Editions.IgnoreQueryFilters().FirstOrDefault(e => e.Name == EditionManager.DefaultEditionName);

This is found on the class "DefaultEditionCreator" on the ourAppName.EntityFrameworkCore project from the asp.net zero template

EntityFrameworkCore.Migrations.Seed.Host.DefaultEditionCreator

Note: The same problem does not happen if we generate the migrations for MS SQL server

Our MySql server is version 5.7, running on Linux The MySql.Data and MySql.Data.EntityFramework client libraries are version 8.0.13 Our web app is built for .net core 2.1 and published as a Linux application


3 Answer(s)