In my Ninject binding module,
public class CarModule : NinjectModule
{
public override void Load()
{
Kernel.Bind(scanner => scanner.FromThisAssembly().SelectAllClasses()
.InheritedFrom<ICar>().BindAllInterfaces());
foreach (var binding in kernel.GetBindings(typeof(ICar)))
{
Trace.WriteLine(string.Format("[{0}] Service bound to [{1}]",
binding.Service.Name,
binding.Target.GetType().Name));
}
// Output looks like:
//[ICar] Service bound to [BindingTarget]
//[ICar] Service bound to [BindingTarget]
//[ICar] Service bound to [BindingTarget]
}
}
I need a sanity check to see types I've successfully bound to my services. I'm having trouble accessing the type names of the bound types. Instead of [BindingTarget]
, I'd like to see [Mercedes]
, [Ferrari]
, etc...
Is there a good and/or common way to do this?