示例#1
0
        internal static void Initialize()
        {
            try
            {
                Provider = new MySqlProvider(
                    Settings.AppSettings.GetStringElement("Database.Host"),
                    Settings.AppSettings.GetStringElement("Database.Name"),
                    Settings.AppSettings.GetStringElement("Database.Username"),
                    Settings.AppSettings.GetStringElement("Database.Password"));
                Provider.Connect();

                RealmProvider = new MySqlProvider(
                    Settings.AppSettings.GetStringElement("Database.Host"),
                    Settings.AppSettings.GetStringElement("Database.rName"),
                    Settings.AppSettings.GetStringElement("Database.Username"),
                    Settings.AppSettings.GetStringElement("Database.Password"));
                RealmProvider.Connect();

                Logger.Info("Connected to the database !");
            }
            catch (Exception e)
            {
                Logger.Error("Can't connect to database : " + e.ToString());
            }
        }