0

I've (My client) have a project which is being ported over to .net core, and thus the ninject dependency is being removed (as it doesn't support core yet).

I have some things in the project which call Kernal.Get<T> of things that aren't bound in Ninject, yet it still finds them.

Am I correct in saying it can look things up without knowing about them? And will I have to recreate this functionality myself for .netcore?

Stuart.Sklinar
  • 3,683
  • 4
  • 35
  • 89

1 Answers1

1

There's a fallback where if you request a a non-abstract class type - one that you can instanciate - ninject will create that as if you'd have written a Bind<Foo>().ToSelf() (....InTransientScope(), which is the default).

What it doesn't automagically do is create a mapping from an interface (or abstract type) to an instanciatable class. So IFoo => Foo requires a binding. However, if you seem to experience such automagics it might be because the project employs Ninject.Extensions.Conventions.

BatteryBackupUnit
  • 12,934
  • 1
  • 42
  • 68