Example #1
0
        private void InitContainer()
        {
            Logger.Info("NzbDrone Starting up.");
            var dispatch = new CentralDispatch();
            dispatch.DedicateToHost();

            dispatch.ContainerBuilder.RegisterAssemblyTypes(typeof(MvcApplication).Assembly).SingleInstance();
            dispatch.ContainerBuilder.RegisterAssemblyTypes(typeof(MvcApplication).Assembly).AsImplementedInterfaces().SingleInstance();

            MVCRegistration(dispatch.ContainerBuilder);

            var container = dispatch.BuildContainer();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));

            //SignalR
            RouteTable.Routes.MapHubs();

            //ServiceStack
            dispatch.ContainerBuilder.RegisterType<MemoryCacheClient>().As<ICacheClient>().SingleInstance();
            dispatch.ContainerBuilder.RegisterType<SessionFactory>().As<ISessionFactory>().SingleInstance();
            new AppHost(container).Init();
        }