GetProvider() public method

public GetProvider ( string dbmsType ) : DatabaseProvider
dbmsType string
return DatabaseProvider
Esempio n. 1
0
        public IDbConnection CreateConnection()
        {
            DatabaseProvider provider = providers.GetProvider(dbms);

            if (provider == null)
            {
                throw new ArgumentException("Supported dbms: ora, mssql, mysql.");
            }

            Assembly assembly = Assembly.Load(provider.AssemblyName);
            Type     type     = assembly.GetType(provider.ConnectionClass);

            return((IDbConnection)Activator.CreateInstance(type, connectionString));
        }
Esempio n. 2
0
 public void TestCanLoadMsSqlProvider()
 {
     Assert.IsNotNull(providers.GetProvider("mssql"));
 }