6.1.4: e.g. 6.10 Using the Ninject WithPropertyValue Method
This commit is contained in:
parent
cbd679abba
commit
d597a410d4
@ -13,8 +13,11 @@ namespace NinjectDemo
|
||||
static void Main(string[] args)
|
||||
{
|
||||
IKernel ninjectKernel = new StandardKernel();
|
||||
ninjectKernel.Bind<IValueCalculator>().To<LinqValueCalculator>();
|
||||
ninjectKernel.Bind<IDiscountHelper>().To<DefaultDiscountHelper>();
|
||||
ninjectKernel.Bind<IValueCalculator>()
|
||||
.To<LinqValueCalculator>();
|
||||
ninjectKernel.Bind<IDiscountHelper>()
|
||||
.To<DefaultDiscountHelper>()
|
||||
.WithPropertyValue("DiscountSize", 50M);
|
||||
|
||||
// get the interface implementation
|
||||
IValueCalculator calcImp1 = ninjectKernel.Get<IValueCalculator>();
|
||||
|
Loading…
x
Reference in New Issue
Block a user