title: ASP.NET Core MVC MySQL Identity
body: <p>I'm using 3rd party MySQL EntityFrameworkCore Extension</p>
  
  <p>"SapientGuardian.EntityFrameworkCore.MySql": "7.1.7"</p>
  
  <p>Everything works but now I decided to use AspNetCore Identity Framework so I changed my DbContext to IdentityDbContext:</p>
  
  <pre><code>public class TwitchCharDbContext : IdentityDbContext&lt;ApplicationUser, ApplicationRole, int&gt;
  {
      public TwitchCharDbContext (DbContextOptions&lt;TwitchCharDbContext&gt; options) 
          : base(options)
      { }
  }
  </code></pre>
  
  <p>When I run command to update database:</p>
  
  <pre><code>dotnet ef migrations add init
  dotnet ef database update
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>System.InvalidOperationException: No mapping to a relational type can be found for the CLR type 'Microsoft.EntityFrameworkCore.Metadata.Internal.Property'
     at Microsoft.EntityFrameworkCore.Storage.RelationalTypeMapperExtensions.GetMapping(IRelationalTypeMapper typeMapper, IProperty property)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.GetColumnType(String schema, String table, String name, Type clrType, Nullable`1 unicode, Nullable`1 maxLength, Boolean rowVersion, IModel model)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.ColumnDefinition(String schema, String table, String name, Type clrType, String type, Nullable`1 unicode, Nullable`1 maxLength, Boolean rowVersion, Boolean nullable, Object defaultValue, String defaultValueSql, String computedColumnSql, IAnnotatable annotatable, IModel model, MigrationCommandListBuilder builder)
     at MySQL.Data.Entity.Migrations.MySQLMigrationsSqlGenerator.ColumnDefinition(String schema, String table, String name, Type clrType, String type, Nullable`1 unicode, Nullable`1 maxLength, Boolean rowVersion, Boolean nullable, Object defaultValue, String defaultValueSql, String computedColumnSql, IAnnotatable annotatable, IModel model, MigrationCommandListBuilder builder)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.ColumnDefinition(AddColumnOperation operation, IModel model, MigrationCommandListBuilder builder)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(CreateTableOperation operation, IModel model, MigrationCommandListBuilder builder)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
     at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model)
     at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration)
     at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
     at Microsoft.EntityFrameworkCore.Design.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
     at Microsoft.EntityFrameworkCore.Tools.Cli.DatabaseUpdateCommand.&lt;&gt;c__DisplayClass0_0.&lt;Configure&gt;b__0()
     at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
     at Microsoft.EntityFrameworkCore.Tools.Cli.Program.Main(String[] args)
  No mapping to a relational type can be found for the CLR type 'Microsoft.EntityFrameworkCore.Metadata.Internal.Property'
  </code></pre>
  
  <p>Important note is that if I change destination database to MS SQL in Startup.cs it works as expected.</p>
  
  <pre><code>services.AddIdentity&lt;ApplicationUser, ApplicationRole&gt;(options =&gt;
              {
                  options.Cookies.ApplicationCookie.ExpireTimeSpan = TimeSpan.FromDays(30);
                  options.Cookies.ApplicationCookie.SlidingExpiration = true;
                  options.Cookies.ApplicationCookie.LoginPath = new PathString("/auth/sign-in");
              }).AddEntityFrameworkStores&lt;TwitchCharDbContext, int&gt;();
  
  services.AddDbContext&lt;TwitchCharDbContext&gt;(opt =&gt; {
                  //opt.UseSqlServer(Configuration.GetConnectionString("TwitchChar"));
                  opt.UseMySQL(
                      connectionString
                  );
              });
  </code></pre>
  
  <p>Thank you</p>