Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 713 posts 954 karma points
    Mar 05, 2014 @ 03:11
    Tom
    0

    using Bootstrap.Ninject with Umbraco 7?

    Hi All,

    I'm able to use ninject.web.common with the ninject mvc3 package successfully in v7.

     

    I was trying to go one step further and hook in to global and use Bootstrap.Ninject to just setup some default resolves so I don't have to manually create bindings everywhere:

    public class MvcApplication : Umbraco.Web.UmbracoApplication

        {

            protected void Application_Start()

            {

    Bootstrap();

            }

     

    static void Bootstrap()

    {

    var kernel = DependencyResolver.Current.GetService<IKernel>();

     

    Bootstrapper.With.Ninject().WithContainer(kernel).Start();

     

    kernel.Bind(configure =>

    configure

    .FromAssembliesMatching("TomsAssemblyOfMystery.*")

    .IncludingNonePublicTypes()

    .SelectAllClasses()

    .BindDefaultInterface());

    }

        }

     

    For some reason these bindings are never getting mapped. Just wondering if anyone has tried using Bootstrap.Ninject with umbraco?

     

    I've double checked and my global.asax file maps to 

    <%@ Application Codebehind="Global.asax.cs" Inherits="TomsAssemblyOfMystery.Web.MvcApplication" Language="C#" %>

Please Sign in or register to post replies

Write your reply to:

Draft