Beispiel #1
0
        static LoggingDatabase()
        {
            _sessionFactory = new Lazy<ISessionFactory>(() =>
            {
                var config = new Configuration();

                config.SetProperty(NHibernate.Cfg.Environment.Hbm2ddlKeyWords, "auto-quote");
                config.Configure(Database.ConfigurationFilePath);

                var mapperFactory = new AttributeMapperFactory();
                mapperFactory.RegisterMappers(new[] { Assembly.GetExecutingAssembly() });

                config.AddMapping(new ConventionMappingCompiler("cms", mapperFactory).AddEntityTypes(new[] { typeof(LogEntry) }).CompileMapping());

                return config.BuildSessionFactory();
            }, true);
        }
Beispiel #2
0
        void Application_Start(object sender, EventArgs e)
        {
            _logger.Info(UserReference.System(), "Application starting...");

            CmsConfiguration.Initialize();
            LicensingService.ValidateCurrentLicense();

            // Attribute mapping factory
            var mapperFactory = new AttributeMapperFactory();
            mapperFactory.RegisterMappers(new[] { Assembly.Load("Seeger.Core") });

            AttributeMapperFactories.Current = mapperFactory;

            Database.Initialize();

            TaskQueues.StartDefaultQueues();

            ResourceBundler.Initialize();

            GlobalConfiguration.Configure(WebApiConfig.Configure);

            // TODO: Better to provide some IStartupTask interface
            if (FileBucketMetaStores.Current.GetBucketCount() == 0)
            {
                var service = new FileBucketService(FileBucketMetaStores.Current);
                var meta = service.CreateBucket("Local", "Local", new Dictionary<string, string>
                {
                    { "BaseVirtualPath", "/Files/" }
                });

                service.SetDefault(meta.BucketId);
            }

            PluginManager.StartupEnabledPlugins();

            Event.Raise(new ApplicationStarted(this));
        }