Example #1
0
        public override void Configure(Container container)
        {
            _logger.Debug("Configuring");

            container.Adapter = _autofacIocAdapter;
            AppSettings       = container.Resolve <IAppSettings>();

            JsConfig.EmitCamelCaseNames = true;

            GlobalHtmlErrorHttpHandler = new RazorHandler("/oops");

            Configuration = container.Resolve <IEkklesiaConfiguration>();

            SetConfig(new HostConfig
            {
                DebugMode  = _hostingEnvironment.IsDevelopment() || Configuration.DebugMode,
                WebHostUrl = _configuration["SiteUrl"]
            });

            Plugins.Add(new RazorFormat());
            Plugins.Add(new ValidationFeature());
            Plugins.Add(new RequestLogsFeature());

            IDbMigrator migrator = container.Resolve <IDbMigrator>();

            migrator.Migrate();
        }
Example #2
0
        public void ViewList(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string html = RazorHandler.ParseRazor(context, "../View/index.cshtml");

            context.Response.Write(html);
        }
Example #3
0
        public override void Configure(Container container)
        {
            _logger.Debug("Configuring");

            container.Adapter = _autofacIocAdapter;
            AppSettings       = container.Resolve <IAppSettings>();

            //Set JSON web services to return idiomatic JSON camelCase properties
            JsConfig.EmitCamelCaseNames = true;

            GlobalHtmlErrorHttpHandler = new RazorHandler("/oops");

            Configuration = container.Resolve <ISoundWordsConfiguration>();

            SetConfig(new HostConfig
            {
                DebugMode  = _hostingEnvironment.IsDevelopment() || Configuration.DebugMode,
                WebHostUrl = _configuration["SITE_URL"]
            });

            ConfigureAuth(container);

            MimeTypes.ExtensionMimeTypes["manifest"] = "text/cache-manifest";
            MimeTypes.ExtensionMimeTypes["appcache"] = "text/cache-manifest";
            MimeTypes.ExtensionMimeTypes["ico"]      = "image/x-icon";
            Config.AllowFileExtensions.Add("manifest");
            Config.AllowFileExtensions.Add("appcache");

            Plugins.Add(new RazorFormat());
            Plugins.Add(new ValidationFeature());
            Plugins.Add(_serverEventsFeature);

            IDbMigrator migrator = container.Resolve <IDbMigrator>();

            migrator.Migrate();

            OrmLiteConfig.InsertFilter += (command, o) =>
            {
                DbEntity entity = o as DbEntity;
                if (entity == null)
                {
                    return;
                }

                entity.CreatedOn  = DateTime.UtcNow;
                entity.ModifiedOn = DateTime.UtcNow;
            };

            OrmLiteConfig.UpdateFilter += (command, o) =>
            {
                DbEntity entity = o as DbEntity;
                if (entity == null)
                {
                    return;
                }

                entity.ModifiedOn = DateTime.UtcNow;
            };
        }