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

Initialise() public method

Initialises BrickPile.
public Initialise ( ) : void
return void
        public void Initialise()
        {
            this.ConfigureDocumentStoreInternal((EmbeddableDocumentStore) DocumentStore);

            this.ConfigureDocumentStore(DocumentStore);

            this.Container = this.GetApplicationContainer();

            this.ConfigureApplicationContainerInternal(this.Container, DocumentStore);

            this.ConfigureApplicationContainer(this.Container);

            this.ConfigureConventions(this.Conventions);

            this.CreateDefaultDocuments(DocumentStore);

            this.RegisterRoutes(RouteTable.Routes);

            // Register structuremap as dependency resolver
            DependencyResolver.SetResolver(new StructureMapDependencyResolver(this.Container));

            // Set the dependency resolver for the web api
            GlobalConfiguration.Configuration.Services.Replace(typeof (IHttpControllerActivator),
                new StructureMapControllerActivator(this.Container));

            // Extended metadata provider handling GroupName on the DisplayAttribute
            ModelMetadataProviders.Current = new ExtendedDataAnnotationsModelMetadataProvider();

            ModelValidatorProviders.Providers.Add(new ContentTypeMetadataValidatorProvider());

            ModelMetadataProviders.Current = new MetadataProvider();

            ControllerBuilder.Current.SetControllerFactory(new BrickPileControllerFactory(
                DocumentStore,
                new DefaultBrickPileContextFactory(
                    new RouteResolverTrie(
                        () => new HttpContextWrapper(HttpContext.Current),
                        DocumentStore),
                    new DefaultNavigationContextFactory(
                        () => new HttpContextWrapper(HttpContext.Current).Request.RequestContext,
                        new RouteResolverTrie(
                            () => new HttpContextWrapper(HttpContext.Current),
                            DocumentStore),
                        DocumentStore)),
                new RouteResolverTrie(
                    () => new HttpContextWrapper(HttpContext.Current),
                    DocumentStore),
                new DefaultNavigationContextFactory(
                    () => new HttpContextWrapper(HttpContext.Current).Request.RequestContext,
                    new RouteResolverTrie(
                        () => new HttpContextWrapper(HttpContext.Current),
                        DocumentStore),
                    DocumentStore)));

            RouteTable.Routes.RouteExistingFiles = false;

            RouteTable.Routes.AppendTrailingSlash = true;

            RouteTable.Routes.LowercaseUrls = true;

            ViewEngines.Engines.Clear();

            ViewEngines.Engines.Add(new RazorViewEngine());

            // Ensure secure by default
            GlobalFilters.Filters.Add(new AuthorizeContentAttribute(DocumentStore));
        }