Exemplo n.º 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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
 public static void SetDefaultDatabase(DatabaseType databaseType, string connectionString)
 {
     defaultDbGateway = new DbGateway(new Database(CreateDbProvider(databaseType, connectionString)));
 }
Exemplo n.º 4
0
 public static void SetDefaultDatabase(string connectionStringSectionName) 
 {
     defaultDbGateway = new DbGateway(connectionStringSectionName);
 }
Exemplo n.º 5
0
 public static void SetDefaultDatabase(DatabaseType databaseType, string connectionString)
 {
     defaultDbGateway = new DbGateway(new Database(CreateDbProvider(databaseType, connectionString)));
 }
Exemplo n.º 6
0
 public static void SetDefaultDatabase(string connectionStringSectionName)
 {
     defaultDbGateway = new DbGateway(connectionStringSectionName);
 }