I’m playing with kodein and liking it so far.
I’m trying to bind multiple types from a common interface into a loop, but I’m having a bad time to figure the best way of doing this.
Imagine I have a List<Repository> that contains: UserRepository and CompanyRepository as concrete impl. I’m trying to accomplish is something like:
repositories.forEach {
bind<???>() from provider { <create_repo> }
}
Is there a way to specify the type as a param of bind? Something like: bind(type, tag)?
If I do not specify the type, both repo will be bind with the Repository forcing me to use a tag (for instance the class) and get them with:
kodein.instance<Repository>(UserRepository::class)
, however instead I’d really like to simply do:
kodein.instance<UserRepository>()
.