Inconsistent accessibility: "value" parameter type is less accessible than "value" method

Asked

Viewed 1,719 times

1

Inconsistent accessibility: "Iclientmanager" parameter type is less accessible than "Clientecontroller.Clientcontroller(Iclientmanager, Usermanager)

Controller:

public class ClientController : Controller
{
    private readonly IClientManager _clientManager;
    private readonly UserManager<ApplicationUser> _userManager;

    public ClientController(   <-  Erro está aqui
        IClientManager clientManager,
        UserManager<ApplicationUser> userManager)
    {
        _clientManager = clientManager;
        _userManager = userManager;
    }
}

Iclientmanager:

internal interface IClientManager : IDisposable
{
    Task<ApplicationClient> CreateClientAsync(ApplicationClient client);
}

Startup:

services.AddScoped<IClientManager, ClientManager>();

Clientmanager:

public class ClientManager : IClientManager
{
    private ApplicationDbContext _context;

    public ClientManager(ApplicationDbContext context)
    {
        _context = context;
    }

    public async Task<ApplicationClient> CreateClientAsync(ApplicationClient client)
    {
        var result = await _context.Clientes.AddAsync(client);

        if (result.State == EntityState.Added)
        {
            _context.SaveChanges();
        }

        return result.Entity;
    }
}

1 answer

2


Declare the interface as public:

public interface IClientManager : IDisposable

Thus it is at the same level of accessibility as the "Clientcontroller" class, which is public

  • Now gave the following message Mais de um modificador de proteção

  • sorry there was an error in the reply, already corrected

  • Now it worked perfectly

Browser other questions tagged

You are not signed in. Login or sign up in order to post.