rocketraman
04/06/2023, 2:43 PMFooBar: Foo, Bar
. Instead of:
inBindSet<Foo> {
bind { singleton { new(::FooBar) } }
}
inBindSet<Bar> {
bind { singleton { new(::FooBar) } }
}
which seems like it will create two singletons, and even if it doesn't, it isn't very clearly expressing intent.
I should be able to do:
bind { singleton { new(::FooBar) } }
inBindSet<Foo> {
add { instance<FooBar>() }
}
inBindSet<Bar> {
add { instance<FooBar>() }
}
but I can't figure out the syntax.romainbsl
04/06/2023, 3:20 PMbind { singleton { Cls() } }
bindSet<Itf> {
add { singleton { instance<Cls>() } }
}
bindSet<Itf2> {
add { singleton { instance<Cls>() } }
}
here is the documentation https://kosi-libs.org/kodein/7.19/core/multi-binding.html