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

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @commondesk

    Are you using https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql ? If not, could you try to use it ?

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    commondesk created

    We will try and report back.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)