1

in ASP Net 4 with Ninject in order to map interfaces to default classes (i.e IMyClass to MyClass) I could do the following:

kernel.Bind(x =>
        {
            x.FromAssemblyContaining<ILibraryMarker>()
             .SelectAllClasses()
             .BindDefaultInterface();
        });

I cannot figure out how to do this in ASP NET vNext, since it has its own IoC.

Any ideas?

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
user3454492
  • 63
  • 2
  • 5

1 Answers1

0

Unfortunately this is not possible with ASP.NET 5 DI. You will have to register all services explicitly. Like so:

services.AddScoped<ILibraryMarker, LibraryMarker>();

Please see https://github.com/aspnet/DependencyInjection/issues/322 which might be able to help you.

For historical value, Ninject was included up until beta6 here but has since not been update or released. Perhaps this could be initiative for someone to take over?

I hope this helps.

Nick De Beer
  • 5,232
  • 6
  • 35
  • 50