public DBAccess()
        {
            var config   = new Configuration();
            var settings = new SimpleConfiguration();

            config.AddAssembly("FragmentNetslumServer");

            config.DataBaseIntegration(db => {
                db.ConnectionString = "Server=" + settings.Get("dbhost") +
                                      ";Port=" + settings.Get("dbport") +
                                      ";Database=" + settings.Get("dbname") +
                                      ";User ID=" + settings.Get("dbuser") +
                                      ";Password="******"dbpass") +
                                      ";SslMode=none";
                db.Driver <MySqlDataDriver>();
                db.Dialect <MySQL5Dialect>();
            });

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            _encoding = Encoding.GetEncoding("Shift-JIS");

            _sessionFactory = config.BuildSessionFactory();



            //_messageOfTheDay = LoadMessageOfDay();
        }
        // if you modify InitializeContainer you gotta go down below
        // and add it to the ConfigureServices() if you want WebAPI to care about
        // it otherwise tough cookies.
        private static IServiceCollection InitializeContainer()
        {
            return(new ServiceCollection()
                   .AddTransient <ILogger>((provider) =>
            {
                var cfg = new SimpleConfiguration();
                var logConfig = new LoggerConfiguration();

                // configure the sinks appropriately
                var sinks = cfg.Get("sinks")?.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                if (sinks.Contains("console", StringComparer.OrdinalIgnoreCase))
                {
                    logConfig.WriteTo.Console();
                }
                if (sinks.Contains("file", StringComparer.OrdinalIgnoreCase))
                {
                    var path = cfg.Get("folder");
                    if (!System.IO.Directory.Exists(path))
                    {
                        System.IO.Directory.CreateDirectory(path);
                    }

                    logConfig.WriteTo.File(
                        formatter: new JsonFormatter(),
                        path: path,
                        buffered: true,
                        flushToDiskInterval: TimeSpan.FromMinutes(1),
                        rollingInterval: RollingInterval.Hour,
                        rollOnFileSizeLimit: true,
                        retainedFileCountLimit: 31,
                        fileSizeLimitBytes: ONE_GIGABYTE,
                        encoding: Encoding.UTF8);
                }

                // set the minimum level
                var lobbyLogLevel = cfg.Get("lobbyloglevel");
                var apiLogLevel = cfg.Get("apiloglevel");
                logConfig.MinimumLevel.Is(Enum.Parse <LogEventLevel>(lobbyLogLevel));
                logConfig.MinimumLevel.Override("Microsoft.AspNetCore", Enum.Parse <LogEventLevel>(apiLogLevel))
                .Enrich.FromLogContext()
                .Enrich.WithExceptionDetails();
                return logConfig.CreateLogger();
            })
                   .AddSingleton <IClientProviderService, GameClientService>()
                   .AddSingleton <IClientConnectionService, ClientConnectionService>()
                   .AddSingleton <ILobbyChatService, LobbyChatService>()
                   .AddSingleton <IMailService, MailService>()
                   .AddSingleton <IBulletinBoardService, BulletinBoardService>()
                   .AddSingleton <INewsService, NewsService>()
                   .AddSingleton <IOpCodeProviderService, OpCodeProviderService>()
                   .AddSingleton <IRankingManagementService, RankingManagementService>()
                   .AddSingleton <IGuildManagementService, GuildManagementService>()
                   .AddTransient <GameClientAsync>()
                   .AddSingleton <SimpleConfiguration>()
                   .AddSingleton <Server>());
        }