BrickPile.Core.DefaultBrickPileBootstrapper.ConfigureApplicationContainerInternal C# (CSharp) Method

ConfigureApplicationContainerInternal() protected method

Configures the application container with registrations needed for BrickPile to work properly
protected ConfigureApplicationContainerInternal ( IContainer container, IDocumentStore documentStore ) : void
container IContainer The container.
documentStore IDocumentStore The document store.
return void
        protected void ConfigureApplicationContainerInternal(IContainer container, IDocumentStore documentStore)
        {
            container.Configure(expression =>
            {
                expression.For<IDocumentStore>()
                    .Singleton()
                    .Use(documentStore);
                expression.For<IRouteResolver>()
                    .Use<DefaultRouteResolver>();
                expression.Scan(scanner =>
                {
                    scanner.AssembliesFromApplicationBaseDirectory();
                    scanner.ExcludeNamespace("System");
                    scanner.ExcludeNamespace("Microsoft");
                    scanner.ExcludeNamespace("WebActivatorEx");
                    scanner.ExcludeNamespace("Newtonsoft");
                    scanner.ExcludeNamespace("Raven");
                    scanner.WithDefaultConventions();
                    scanner.Convention<ContentTypeRegistrationConvention>();
                });
                expression.For<IPage>()
                    .UseSpecial(
                        x =>
                            x.ConstructedBy(
                                () =>
                                    ((MvcHandler) HttpContext.Current.Handler).RequestContext.RouteData
                                        .GetCurrentPage<IPage>()));
                expression.For<INavigationContext>()
                    .UseSpecial(
                        x =>
                            x.ConstructedBy(
                                () =>
                                    new NavigationContext(((MvcHandler) HttpContext.Current.Handler).RequestContext)));
                expression.For<IBrickPileContext>()
                    .UseSpecial(
                        x => x.ConstructedBy(
                            () =>
                                new BrickPileContext(((MvcHandler) HttpContext.Current.Handler).RequestContext)
                            )
                    );
            });
        }