1
I have the following problem when applying the Simpleinjector container in a simple application:
The configuration is invalid.
The type BookAppService is directly or indirectly depending on itself.
The cyclic graph contains the following types: BookAppService -> BookAppService -> BookAppService.
This is the Bookappservice class:
public class BookAppService : AppServiceBase<Book>, IBookAppService
{
private readonly IBookAppService _bookService;
public BookAppService(IBookAppService bookService) : base(bookService)
{
_bookService = bookService;
}
public IEnumerable<Book> GetSpecialBooks(IEnumerable<Book> books)
{
return _bookService.GetSpecialBooks(_bookService.GetAll());
}
And this is the configuration of the Simpleinjectorinitializer:
container.Register(typeof(IAppServiceBase<>), typeof(AppServiceBase<>));
container.Register<IBookAppService, BookAppService>(Lifestyle.Scoped);
I am very beginner in Ioc and DI, and thank you for any help and tip. Thank you.
You need to put
AppServiceBase<>
andIBookAppService
...– novic