Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

484
Vistas
Cannot convert from 'string' to 'Microsoft.EntityFrameworkCore.ServerVersion

I'm using C# and have an error: Argument 2: cannot convert from 'string' to 'Microsoft.EntityFrameworkCore.ServerVersion'

    using Microsoft.EntityFrameworkCore;
    using System;
    
    namespace Infrastructure
    {
        public class BotContext : DbContext 
        {
            public DbSet<Server> Servers { get; set; }
    
            protected override void OnConfiguring(DbContextOptionsBuilder options)
                => options.UseMySql("server=localhost;user=root;port=3306;Connect Timeout=5;");
    
            public class Server
            {
                public ulong Id { get; set; }
                public string Prefix { get; set; }
            }
        }
    }
over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

public class BotContext : DbContext 
{
    public DbSet<Server> Servers { get; set; }
    public BotContext()
    {
        Database.EnsureCreated();
    }

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseMySql(
            "server=localhost;user=root;port=3306;Connect Timeout=5;",
            new MySqlServerVersion(new Version(8, 0, 11))
        );
    }

    public class Server
    {
        public ulong Id { get; set; }
        public string Prefix { get; set; }
    }
}

This should help: https://metanit.com/sharp/entityframeworkcore/7.2.php

over 4 years ago · Santiago Trujillo Denunciar

0

Apparently, new version of Pomelo needs more arguments. A simple solution is to add an empty Version class like this in startup.cs:

services.AddDbContext<ApplicationDB>(options =>
                   options.UseMySql(Configuration.GetConnectionString("DefaultConnection"), new MySqlServerVersion(new Version())));
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda