Durgil
Durgil

Reputation: 31

asp.net-core DI - scopes and registration

I'm using the core version pf asp.net the first time and have a few questions about the built in DI container - Yes I know, there are a lot of other Implementations for this task. I just want to be sure.

  1. Multiple implementations of an interface

    As far as I know it is not possible to register more than one implementation of the same interface.

    True?

  2. Named registration

    There is no possibility (like the @qualifier in spring (java)) to register a instance / implementation with a given name.

    True?

  3. Scopes

    There is no scope that has a longer lifetime than request (except singleton) No view / usecase / custom scope (like in java cdi / spring orchestra).

    True?

Any answers would be appreciated
And... yes, I read the docs which are quite..... release candidate like ;-)

Upvotes: 3

Views: 814

Answers (1)

Yaser Moradi
Yaser Moradi

Reputation: 3327

You've provided a correct answer to all your questions. The good news is the two ones can be fixed using custom implementations such as autofac. Do you've any idea about this? How to register different registrations to services (IServicesCollection) for multiple usages of the same middlewares in asp.net core?

Upvotes: 1

Related Questions