Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="diContainer"></param>
        /// <param name="assembly"></param>
        private static void RegisterMvc(IDependencyInjectionContainer diContainer, Assembly assembly)
        {
            // Register Common MVC Types
            diContainer.Configure(c =>
            {
                c.Export<MemoryCache>()
                .WithCtorParam((scope, context) => "CastleWindsorRegistration_Default")
                .WithCtorParam((scope, context) => new NameValueCollection());

                c.Export<RequestContext>()
                .WithCtorParam((scope, context) => new HttpContextWrapper(HttpContext.Current))
                .WithCtorParam((scope, context) => RouteTable.Routes.GetRouteData(new HttpContextWrapper(HttpContext.Current))).Lifestyle.SingletonPerRequest();

                c.Export<UrlHelper>()
                .WithCtorParam((scope, context) => context.Locate<RequestContext>())
                .WithCtorParam((scope, context) => RouteTable.Routes).Lifestyle.SingletonPerRequest();
            });

            // Register MVC Filters

            // Register MVC Controllers
            diContainer.Configure(c =>
            {
                c.ExportAssembly(assembly).ByInterface<IController>();
            });
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="diContainer"></param>
 internal static void RegisterServices(IDependencyInjectionContainer diContainer)
 {
     diContainer.Configure(c =>
     {
         c.Export<CacheService>().As<ICacheService>();
         c.Export<FeedService>().As<IFeedService>();
         c.Export<LoggingService>().As<ILoggingService>().Lifestyle.Singleton();
         c.Export<OpenSearchService>().As<IOpenSearchService>();
         c.Export<RobotsService>().As<IRobotsService>();
         c.Export<SitemapService>().As<ISitemapService>();
         c.Export<SitemapPingerService>().As<ISitemapPingerService>();
     });
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Initialize the bootstrapper
        /// </summary>
        /// <param name="exportEnvironment">export environment</param>
        private void Initialize(ExportEnvironment exportEnvironment)
        {
            Container = new DependencyInjectionContainer(exportEnvironment);

            Container.Configure(new StyleMVVMCompositionRoot());

            Instance = this;
        }