Beispiel #1
0
        static DbGateway() 
        {
            if (ConfigurationManager.ConnectionStrings == null ||
                ConfigurationManager.ConnectionStrings.Count.Equals(0))
            {
                throw new ConfigException("Please provide a connection string including name, provider and connection string.");
            }

            string connectionStringSectionName = ConfigurationManager.ConnectionStrings[0].Name;

            DbProvider dbProvider = DbProviderFactory.CreateDbProvider(connectionStringSectionName);

            defaultDbGateway = new DbGateway(new Database(dbProvider));
        }
Beispiel #2
0
        static DbGateway()
        {
            if (ConfigurationManager.ConnectionStrings == null ||
                ConfigurationManager.ConnectionStrings.Count.Equals(0))
            {
                throw new ConfigException("Please provide a connection string including name, provider and connection string.");
            }

            string connectionStringSectionName = ConfigurationManager.ConnectionStrings[0].Name;

            DbProvider dbProvider = DbProviderFactory.CreateDbProvider(connectionStringSectionName);

            defaultDbGateway = new DbGateway(new Database(dbProvider));
        }
Beispiel #3
0
 public static void SetDefaultDatabase(DatabaseType databaseType, string connectionString)
 {
     defaultDbGateway = new DbGateway(new Database(CreateDbProvider(databaseType, connectionString)));
 }
Beispiel #4
0
 public static void SetDefaultDatabase(string connectionStringSectionName) 
 {
     defaultDbGateway = new DbGateway(connectionStringSectionName);
 }
Beispiel #5
0
 public static void SetDefaultDatabase(DatabaseType databaseType, string connectionString)
 {
     defaultDbGateway = new DbGateway(new Database(CreateDbProvider(databaseType, connectionString)));
 }
Beispiel #6
0
 public static void SetDefaultDatabase(string connectionStringSectionName)
 {
     defaultDbGateway = new DbGateway(connectionStringSectionName);
 }