Skip to content

Improve API of using ServiceProviderFactory base class for Microsoft DI integration - get rid of the DependsOn("Base") #115

@NikolayPianikov

Description

@NikolayPianikov

Previously it was:

partial class Composition: ServiceProviderFactory<Composition>
{
    private void Setup() => DI.Setup()
        .DependsOn(Base)

        .Roots<ControllerBase>()

        .Bind().As(Singleton).To<ClockViewModel>()
        .Bind().To<ClockModel>()
        .Bind().As(Singleton).To<Ticks>()

        // Infrastructure
        .Bind().To<MicrosoftLoggerAdapter<TT>>()
        .Bind().To<CurrentThreadDispatcher>();
}

Now it is:

partial class Composition: ServiceProviderFactory<Composition>
{
    private void Setup() => DI.Setup()
        .Roots<ControllerBase>()

        .Bind().As(Singleton).To<ClockViewModel>()
        .Bind().To<ClockModel>()
        .Bind().As(Singleton).To<Ticks>()

        // Infrastructure
        .Bind().To<MicrosoftLoggerAdapter<TT>>()
        .Bind().To<CurrentThreadDispatcher>();
}

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions