title: Error trying to generate a controller in aspnet core 3 using codegenerator
body: <p>I am starting a new project in <strong>asp net core 3.1.1</strong>, using a <strong>MYSQL</strong> database. I was able to scaffolding the models using the following command</p>
  
  <pre><code>dotnet ef dbcontext scaffold "Server=localhost;User=root;Password=123456;Database=proyecto;TreatTinyAsBoolean=true;" Pomelo.EntityFrameworkCore.MySql -o Models
  </code></pre>
  
  <p>But when I try to generate any controller using the aspnet-codegenerator it generates the following error: Option 'data server' not supported. </p>
  
  <pre><code>Attempting to figure out the EntityFramework metadata for the model and DbContext: 'Contacto'
  Option 'data server' not supported. StackTrace:
     at MySql.Data.MySqlClient.MySqlConnectionStringOption.GetOptionForKey(String key) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnectionStringBuilder.cs:line 435
     at MySql.Data.MySqlClient.MySqlConnectionStringBuilder.set_Item(String key, Object value) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnectionStringBuilder.cs:line 345
     at System.Data.Common.DbConnectionStringBuilder.set_ConnectionString(String value)
     at MySql.Data.MySqlClient.MySqlConnectionStringBuilder..ctor(String connectionString) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlConnectionStringBuilder.cs:line 18
     at Microsoft.EntityFrameworkCore.MySqlDbContextOptionsExtensions.UseMySql(DbContextOptionsBuilder optionsBuilder, String connectionString, Action`1 mySqlOptionsAction)
     at Lcore.Startup.&lt;ConfigureServices&gt;b__4_0(DbContextOptionsBuilder options)
     at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.&lt;&gt;c__DisplayClass3_0`2.&lt;AddDbContextPool&gt;b__0(IServiceProvider _, DbContextOptionsBuilder ob)
     at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.&lt;&gt;c__DisplayClass5_0`2.&lt;AddDbContextPool&gt;b__0(IServiceProvider sp, DbContextOptionsBuilder ob)
     at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.CreateDbContextOptions[TContext](IServiceProvider applicationServiceProvider, Action`2 optionsAction)
     at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.&lt;&gt;c__DisplayClass10_0`1.&lt;AddCoreServices&gt;b__0(IServiceProvider p)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.&lt;&gt;c__DisplayClass1_0.&lt;RealizeService&gt;b__0(ServiceProviderEngineScope scope)
  Option 'data server' not supported.
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
     at Microsoft.Extensions.DependencyInjection.EntityFrameworkServiceCollectionExtensions.&lt;&gt;c__10`1.&lt;AddCoreServices&gt;b__10_1(IServiceProvider p)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.&lt;&gt;c__DisplayClass1_0.&lt;RealizeService&gt;b__0(ServiceProviderEngineScope scope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
     at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
     at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetServices[T](IServiceProvider provider)      
     at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextTypes()
     at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextType(String name)
     at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
     at Microsoft.EntityFrameworkCore.Design.DbContextActivator.CreateInstance(Type contextType, Assembly startupAssembly, IOperationReportHandler reportHandler)
     at Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.EntityFrameworkModelProcessor.TryCreateContextUsingAppCode(Type dbContextType, Type startupType)
  
     at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.&lt;BuildCommandLine&gt;b__6_0()
     at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
     at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
     at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
  </code></pre>
  
  <p>The command Im using to generate the controller is the follows</p>
  
  <pre><code>dotnet aspnet-codegenerator  controller -name ContactosController  -dc LCoreContext -outDir Controllers -actions -m Contacto -f
  </code></pre>
  
  <p>This is my <strong>DbContext</strong></p>
  
  <pre><code>using System;
  using System.Configuration;
  using Lcore.Models;
  using Microsoft.Extensions.Configuration;
  using Microsoft.EntityFrameworkCore;
  
  
  namespace Lcore.Data
  {
      public partial class LCoreContext : DbContext
      {
          public LCoreContext()
          {
          }
  
          public LCoreContext(DbContextOptions&lt;LCoreContext&gt; options)
              : base(options)
          {
          }
  
          public virtual DbSet&lt;Comprobante&gt; Comprobante { get; set; }
          public virtual DbSet&lt;Contacto&gt; Contacto { get; set; }
          public virtual DbSet&lt;ContactoImagen&gt; ContactoImagen { get; set; }
          public virtual DbSet&lt;Domicilio&gt; Domicilio { get; set; }
          public virtual DbSet&lt;EntidadFiscalContacto&gt; EntidadFiscalContacto { get; set; }
          public virtual DbSet&lt;EntidadFiscal&gt; EntidadFiscal { get; set; }
          public virtual DbSet&lt;Localidad&gt; Localidad { get; set; }
          public virtual DbSet&lt;SituacionTributaria&gt; SituacionTributaria { get; set; }
          public virtual DbSet&lt;TipoIdentificacion&gt; TipoIdentificacion { get; set; }
          public virtual DbSet&lt;Usuarios&gt; Usuarios { get; set; }
  
          protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
          {
              if (!optionsBuilder.IsConfigured)
              {
                  // optionsBuilder.UseMySql("treattinyasboolean=true", x =&gt; x.ServerVersion("10.3.14-mariadb"));
                  optionsBuilder.UseMySql(ConfigurationManager.ConnectionStrings["LCoreConnection"].ConnectionString + "treattinyasboolean=true; " , x =&gt; x.ServerVersion("10.3.14-mariadb"));
              }
          }
  
          protected override void OnModelCreating(ModelBuilder modelBuilder)
          {
              modelBuilder.Entity&lt;Comprobante&gt;(entity =&gt;
              {
                  entity.ToTable("comprobantes");
  
                  entity.HasIndex(e =&gt; e.LocalidadId)
                      .HasName("IDX_18EDF3E967707C89");
  
                  entity.Property(e =&gt; e.Id)
                      .HasColumnName("id")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.Acronimo)
                      .IsRequired()
                      .HasColumnName("acronimo")
                      .HasColumnType("varchar(8)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.Property(e =&gt; e.Activo).HasColumnName("activo");
  
                  entity.Property(e =&gt; e.Discrimina).HasColumnName("discrimina");
  
                  entity.Property(e =&gt; e.FechaCreado)
                      .HasColumnName("fecha_creado")
                      .HasColumnType("datetime");
  
                  entity.Property(e =&gt; e.FechaEditado)
                      .HasColumnName("fecha_editado")
                      .HasColumnType("datetime");
  
                  entity.Property(e =&gt; e.LocalidadId)
                      .HasColumnName("localidad_id")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.Nombre)
                      .IsRequired()
                      .HasColumnName("nombre")
                      .HasColumnType("varchar(64)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.Property(e =&gt; e.Nota)
                      .HasColumnName("nota")
                      .HasColumnType("varchar(124)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.HasOne(d =&gt; d.Localidad)
                      .WithMany(p =&gt; p.Comprobante)
                      .HasForeignKey(d =&gt; d.LocalidadId)
                      .OnDelete(DeleteBehavior.ClientSetNull)
                      .HasConstraintName("FK_18EDF3E967707C89");
              });
  
              modelBuilder.Entity&lt;Contacto&gt;(entity =&gt;
              {
                  entity.ToTable("contactos");
  
                  entity.HasIndex(e =&gt; e.ImagenId)
                      .HasName("UNIQ_3446F2C5763C8AA7")
                      .IsUnique();
  
                  entity.HasIndex(e =&gt; e.LocalidadId)
                      .HasName("IDX_3446F2C567707C89");
  
                  entity.HasIndex(e =&gt; e.TipoIdentificacionId)
                      .HasName("IDX_3446F2C565478DC6");
  
                  entity.Property(e =&gt; e.Id)
                      .HasColumnName("id")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.Activo).HasColumnName("activo");
  
                  entity.Property(e =&gt; e.Apellidos)
                      .IsRequired()
                      .HasColumnName("apellidos")
                      .HasColumnType("varchar(64)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.Property(e =&gt; e.FechaCreado)
                      .HasColumnName("fecha_creado")
                      .HasColumnType("datetime");
  
                  entity.Property(e =&gt; e.FechaEditado)
                      .HasColumnName("fecha_editado")
                      .HasColumnType("datetime");
  
                  entity.Property(e =&gt; e.FechaNacimiento)
                      .HasColumnName("fecha_nacimiento")
                      .HasColumnType("date");
  
                  entity.Property(e =&gt; e.Genero)
                      .HasColumnName("genero")
                      .HasColumnType("smallint(6)");
  
                  entity.Property(e =&gt; e.ImagenId)
                      .HasColumnName("imagen_id")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.LocalidadId)
                      .HasColumnName("localidad_id")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.Nombres)
                      .IsRequired()
                      .HasColumnName("nombres")
                      .HasColumnType("varchar(64)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.Property(e =&gt; e.Nota)
                      .HasColumnName("nota")
                      .HasColumnType("varchar(124)")
                      .HasCharSet("utf8mb4")
                      .HasCollation("utf8mb4_unicode_ci");
  
                  entity.Property(e =&gt; e.NumeroIdentificacion)
                      .HasColumnName("numero_identificacion")
                      .HasColumnType("int(11)");
  
                  entity.Property(e =&gt; e.TipoIdentificacionId)
                      .HasColumnName("tipo_identificacion_id")
                      .HasColumnType("int(11)");
  
                  entity.HasOne(d =&gt; d.Imagen)
                      .WithOne(p =&gt; p.Contacto)
                      .HasForeignKey&lt;Contacto&gt;(d =&gt; d.ImagenId)
                      .HasConstraintName("FK_3446F2C5763C8AA7");
  
                  entity.HasOne(d =&gt; d.Localidad)
                      .WithMany(p =&gt; p.Contacto)
                      .HasForeignKey(d =&gt; d.LocalidadId)
                      .OnDelete(DeleteBehavior.ClientSetNull)
                      .HasConstraintName("FK_3446F2C567707C89");
  
                  entity.HasOne(d =&gt; d.TipoIdentificacion)
                      .WithMany(p =&gt; p.Contacto)
                      .HasForeignKey(d =&gt; d.TipoIdentificacionId)
                      .OnDelete(DeleteBehavior.ClientSetNull)
                      .HasConstraintName("FK_3446F2C565478DC6");
              });
  
               .
  
               .
  
               .
  
              OnModelCreatingPartial(modelBuilder);
          }
  
          partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
      }
  }
  </code></pre>
  
  <p>This is the <strong>model</strong></p>
  
  <pre><code>namespace Lcore.Models
  {
      public partial class Contacto
      {
          public Contacto()
          {
              EntidadFiscalContacto = new HashSet&lt;EntidadFiscalContacto&gt;();
          }
  
          public int Id { get; set; }
          public int? NumeroIdentificacion { get; set; }
          public string Nombres { get; set; }
          public string Apellidos { get; set; }
          public DateTime? FechaNacimiento { get; set; }
          public short? Genero { get; set; }
          public int TipoIdentificacionId { get; set; }
          public int LocalidadId { get; set; }
          public int? ImagenId { get; set; }
          public DateTime FechaCreado { get; set; }
          public DateTime FechaEditado { get; set; }
          public string Nota { get; set; }
          public bool Activo { get; set; }
  
          public virtual ContactoImagen Imagen { get; set; }
          public virtual Localidad Localidad { get; set; }
          public virtual TipoIdentificacion TipoIdentificacion { get; set; }
          public virtual ICollection&lt;EntidadFiscalContacto&gt; EntidadFiscalContacto { get; set; }
      }
  }
  </code></pre>
  
  <p>And this is my services configuration in the <strong>startup.cs</strong> file</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
          {
              services.AddControllersWithViews();
  
               // other service configurations go here
              // replace "YourDbContext" with the class name of your DbContext
              services.AddDbContextPool&lt;LCoreContext&gt;(options =&gt; options
                  // replace with your connection string
                  .UseMySql(Configuration.GetConnectionString("LCoreConnection"), mySqlOptions =&gt; mySqlOptions
                      // replace with your Server Version and Type
                      .ServerVersion(new Version(10, 3, 14), ServerType.MySql)
              ));
          }
  </code></pre>
  
  <p>Database connection error can not be since I could generate the models. And on the other hand I tried to create a controller without an associated model and I had no problems. This was the command I used.</p>
  
  <pre><code>dotnet aspnet-codegenerator  controller -name ContactosController  -dc LCoreContext -outDir Controllers -actions
  </code></pre>
  
  <p>Any help or hint that you can provide me, I will greatly appreciate.</p>