I’m trying to use pranha cms (5.3.1) with MySql. This is the code I’m using in my Startup.cs file, but I get this error:

InvalidOperationException: No service for type ‘Piranha.IApi’ has been registered. What may be the problem?

    public IServiceProvider ConfigureServices(IServiceCollection services)
    {
        services.AddMvc(config =>
        {
            config.ModelBinderProviders.Insert(0, new Piranha.Manager.Binders.AbstractModelBinderProvider());
        });
        services.AddPiranhaApplication();
        services.AddPiranhaFileStorage();
        services.AddPiranhaImageSharp();
        services.AddDbContext<Db>(options =>
            options.UseMySql("server=localhost;port=3306;database=piranha-mysql;uid=root;password="));
        services.AddPiranhaManager();
        services.AddPiranhaMemCache();

        return services.BuildServiceProvider();
    }

Instead of calling AddDbContext you should use:

services.AddPiranhaEF(...);

Which both registers the DbContext and the API that should be used.

Regards