9.3.4 Registering the Implementation; Listing 9-16 Adding Ninject Bindings for IOrderProcessor to the NinjectDependencyResolver.cs File
parent
27f0d26168
commit
ca3c72f560
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
@ -35,8 +36,14 @@ namespace SportsStore.WebUI.Infrastructure
|
|||
private void AddBindings()
|
||||
{
|
||||
kernel.Bind<IProductRepository>().To<EFProductRepository>();
|
||||
}
|
||||
|
||||
EmailSettings emailSettings = new EmailSettings
|
||||
{
|
||||
WriteAsFile = bool.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")
|
||||
};
|
||||
|
||||
kernel.Bind<IOrderProcessor>().To<EmailOrderProcessor>()
|
||||
.WithConstructorArgument("settings", emailSettings);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue