<@U0D06TWMA> ok, then the follow up question. If I...
# kodein
d
@Andreas Sinz ok, then the follow up question. If I have the scope's context as a dependency in one of my modules, can I skip the need to provide it each time on an injection site when retrieving this scoped singleton? Currently I came up with "clever" trick to create another binding that will use the first one. I.e. like so:
Copy code
// binding for "internal" use, shouldn't be invoked by app code
bind<UserProfile>(tag = "internal") with scopedSingleton(mySessionScope) { session -> UserProfile(session.userId) }

bind<UserProfile>() with provider {
  val profileProvider: (Session) -> UserProfile = instance() // will make use of the above binding
  profileProvider.invoke(instance<Session>()) // will make use of Session's binding in current Kodein, to finally return UserProfile
}
I wrote it just before leaving home from work, but didn't check if it actually works 🙂 So I don't know if this is a good thing to do and maybe something even simpler exists in Kodein (I'm still learning this library)