0

In Unity I can register multiple implementation of a given interface and later I can choose which implementation must be injected using a [Dependency("key")] attribute.

How can I achieve this in ASP.NET Core, using a key or using a factory?

Nkosi
  • 235,767
  • 35
  • 427
  • 472
Aref Karimi
  • 1,822
  • 4
  • 27
  • 46
  • 1
    This does not exist out of the box but you can check to see if Unity has an Asp.Net Core DI extension. – Nkosi Mar 19 '18 at 10:47
  • I would say the following quesion solves your question https://stackoverflow.com/questions/38459625/property-injection-in-asp-net-core – Stephu Mar 19 '18 at 11:37
  • Possible duplicate of [Property Injection in Asp.Net Core](https://stackoverflow.com/questions/38459625/property-injection-in-asp-net-core) – Stephu Mar 19 '18 at 11:37
  • Unity can be easily integrated into ASP.NET Core, as [this Github repository](https://github.com/dotnetjunkie/Missing-Core-DI-Extensions/tree/master/src/SampleApplication.Unity) shows. – Steven Mar 19 '18 at 11:45

0 Answers0