private void AddBindings()
        {
            //Mock data
            ////put bindings here
            //var mock = new Mock<IProductRepository>();
            //mock.Setup(m => m.Products).Returns(new List<Product>
            //{
            //    new Product{Name = "Football", Price = 25},
            //    new Product{Name = "Surf board", Price = 179},
            //    new Product{Name = "Running shoes", Price = 95},
            //}.AsQueryable());

            ////What's the function?
            //ninjectKernel.Bind<IProductRepository>().ToConstant(mock.Object);

            NinjectKernel.Bind<IProductRepository>().To<EFProductRepository>();

            NinjectKernel.Bind<IAuthProvider>().To<AuthProvider>();

            var emailSettings = new EmailSettings { WriteAsFile = bool.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")};

            NinjectKernel.Bind<IOrderProcessor>()
                .To<OrderProcessor>()
                .WithConstructorArgument("settings", emailSettings);
        }
        private void AddBindings()
        {
            kernel.Bind<IProductRepository>().To<EFProductRepository>();

            EmailSettings emailSettings = new EmailSettings();

            kernel.Bind<IOrderProcessor>().To<EmailOrderProcessor>().WithConstructorArgument(emailSettings);
        }
        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);

            kernel.Bind<IAuthProvider>().To<FormsAuthProvider>();
        }
        private void AddBindings() {
            // put additional bindings here
            ninjectKernel.Bind<IProductRepository>().To<EFProductRepository>();

            // create the email settings object
            EmailSettings emailSettings = new EmailSettings {
                WriteAsFile 
                    = bool.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")
            };

            ninjectKernel.Bind<IOrderProcessor>()
                .To<EmailOrderProcessor>().WithConstructorArgument("settings", emailSettings);

            ninjectKernel.Bind<IAuthProvider>().To<FormsAuthProvider>();
        }
        private void AddBindings()
        {
            _ninjectKernel.Bind<IProductRepository>().To<EFProductRepository>();

            EmailSettings   settings = new EmailSettings {
                 WriteAsFile = Boolean.Parse(ConfigurationManager.AppSettings["Email.WriteAsFile"] ?? "false")
            };

            _ninjectKernel.Bind<IOrderProcessor>().To<EmailOrderProcessor>().WithConstructorArgument("settings", settings);
            _ninjectKernel.Bind<IAuthProvider>().To<FormsAuthProvider>();
            _ninjectKernel.Bind <IUserStore<ApplicationUser>>().To<UserStore<ApplicationUser>>()
                                                               .WithConstructorArgument("context", new ApplicationDbContext());
            _ninjectKernel.Bind<UserManager<ApplicationUser>>().To<UserManager<ApplicationUser>>()
                                                               .InSingletonScope();

            // put additional bindings here
        }
Exemplo n.º 6
0
        private void AddBindings()
        {
            /* Mock<IProductRepository> mock = new Mock<IProductRepository>();

            mock.Setup(m => m.Products).Returns(new List<Product>
            {
                new Product{Name="Football",Price=25},
                new Product{Name="Surf Board",Price=179},
                new Product{Name="Running shoes",Price=95}
            });*/

            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);
        }
Exemplo n.º 7
0
 public EmailOrderProcessor(EmailSettings emailSettingsParam)
 {
     emailSettings = emailSettingsParam;
 }
 public EmailOrderProcessor(EmailSettings settings)
 {
     _settings = settings;
 }
Exemplo n.º 9
0
 public EmailOrderProcessor(EmailSettings settings)
 {
     emailSettings = settings;
 }
Exemplo n.º 10
0
 public EmailOrderProcessor(EmailSettings emailSettings)
 {
     _emailSettings = emailSettings;
 }