示例#1
0
 public static void SetODAConfig(DbAType DbType, string ConectionString)
 {
     if (string.IsNullOrWhiteSpace(ConectionString))
     {
         throw new ODAException(30010, "DataBase Conection String should be setted.");
     }
     ODAConfig = new ODAConfiguration()
     {
         Pattern     = ODAPattern.Single,
         ODADataBase = new ODAConnect()
         {
             DBtype           = DbType,
             ConnectionString = ConectionString
         }
     };
 }
示例#2
0
 public static void SetODAConfig(ODAConfiguration Config)
 {
     if (Config == null)
     {
         throw new ODAException(30011, "Config can be null.");
     }
     if (Config.Pattern == ODAPattern.Dispersed)
     {
         if (Config.DispersedDataBase == null || Config.DispersedDataBase.Length == 0)
         {
             throw new ODAException(30012, "Dispersed DataBase can be null.");
         }
         foreach (var Db in Config.DispersedDataBase)
         {
             if (string.IsNullOrWhiteSpace(Db.DataBaseId))
             {
                 throw new ODAException(30013, "Dispersed DataBase ID should be setted.");
             }
         }
     }
     else if (Config.Pattern == ODAPattern.MasterSlave)
     {
         if (Config.ODADataBase == null || string.IsNullOrWhiteSpace(Config.ODADataBase.ConnectionString))
         {
             throw new ODAException(30014, "Master DataBase should be setted.");
         }
     }
     else
     {
         if (Config.ODADataBase == null || string.IsNullOrWhiteSpace(Config.ODADataBase.ConnectionString))
         {
             throw new ODAException(30015, "DataBase should be setted.");
         }
     }
     ODAConfig = Config;
 }