Replies: 1 comment 9 replies
-
There's no way to do that at the moment. This is due to the fact that we will have to analyze too many variants for the roots of the composition (hypothetically and generally). But you can simplify your setup like this: public partial class Composition : ServiceProviderFactory<Composition>
{
[Conditional(nameof(DI))]
static void Setup() => DI.Setup()
.DependsOn(Base)
.Bind().To<ADependency>()
.Bind().To<BDependency>()
.Bind().To<Service<TT>>()
.Root<Service<A>>()
.Root<Service<B>>();
} |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Consider the following code, the types
A
andB
are like model types. Each of the model provide a specific implementation for generic interfaceIDependency
.The generic type
Service
consume the dependencies with a generic parameter.But the DI decleration for services in composition is really cumbersome if we have more model types.
Is there any way to simplify the decleration into one line?
Beta Was this translation helpful? Give feedback.
All reactions