6.1.5: e.g. 6.13 Using Ninject Self-Binding
parent
ebb1840db9
commit
bf4277e47e
|
@ -22,7 +22,7 @@ namespace NinjectDemo
|
||||||
// get the interface implementation
|
// get the interface implementation
|
||||||
IValueCalculator calcImp1 = ninjectKernel.Get<IValueCalculator>();
|
IValueCalculator calcImp1 = ninjectKernel.Get<IValueCalculator>();
|
||||||
// create the instance of ShoppingCart and inject the dependency
|
// create the instance of ShoppingCart and inject the dependency
|
||||||
ShoppingCart cart = new ShoppingCart(calcImp1);
|
ShoppingCart cart = ninjectKernel.Get<ShoppingCart>();
|
||||||
// perform the calculation and write out the result
|
// perform the calculation and write out the result
|
||||||
Console.WriteLine("Total: {0:c}", cart.CalculateStockValue());
|
Console.WriteLine("Total: {0:c}", cart.CalculateStockValue());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue