Esempio n. 1
0
 private static void BeforeInit(
     TempDBMySql self,
     Action <object> beforeInit,
     TempDbMySqlServerSettings settings)
 {
     self._autoDeleter = new AutoDeleter();
     self.Settings     = settings;
     beforeInit?.Invoke(self);
 }
Esempio n. 2
0
 public TempDBMySql(
     TempDbMySqlServerSettings settings,
     Action <object> beforeInit,
     params string[] creationScripts
     ) : base(
         o => BeforeInit(o as TempDBMySql, beforeInit, settings),
         creationScripts
         )
 {
 }
Esempio n. 3
0
 public TempDBMySql(
     TempDbMySqlServerSettings settings,
     params string[] creationScripts
     )
     : this(
         settings,
         o =>
 {
 },
         creationScripts)
 {
 }
Esempio n. 4
0
        private void AddSetting(
            INIFile.INIFile iniFile,
            PropertyInfo prop,
            TempDbMySqlServerSettings tempDbMySqlSettings
            )
        {
            var settingAttrib = prop.GetCustomAttributes()
                                .OfType <SettingAttribute>()
                                .FirstOrDefault();

            if (settingAttrib == null)
            {
                return;
            }
            iniFile[SECTION][settingAttrib.Name] = $"{prop.GetValue(tempDbMySqlSettings)}";
        }
Esempio n. 5
0
        public string GenerateFor(TempDbMySqlServerSettings tempDbMySqlSettings)
        {
            if (tempDbMySqlSettings == null)
            {
                throw new ArgumentNullException(nameof(tempDbMySqlSettings));
            }

            var iniFile = new INIFile.INIFile();

            iniFile.AddSection(SECTION);
            tempDbMySqlSettings
            .GetType()
            .GetProperties()
            .ForEach(prop => AddSetting(iniFile, prop, tempDbMySqlSettings));
            return(iniFile.ToString());
        }