I'm having trouble mapping Interface IClienteRepository
to class ClienteRepository
. When compiling the application, this error appears:
"exception {" To be able to use the Lifestyle.Scoped property, please ensure that the container is configured with the default lifestyle set by the Container.Options.DefaultScopedLifestyle property with the required lifestyle scoped for your type of application. See: link "} System.InvalidOperationException"
How to solve?
public static Container RegisterServices(Container container)
{
//Domain to Repository
container.Register<IClienteRepository, ClienteRepository>(Lifestyle.Scoped);
return container;
}
public interface IClienteRepository : IRepository<Cliente>
{
}
public class ClienteRepository : Repository<Cliente>, IClienteRepository
{
public ClienteRepository(SistemaComercialContext context)
:base(context)
{
}
}