예제 #1
0
    private static LazyDatabaseConnection CreateConnection( ProviderConfigElement provider)
    {
        LazyDatabaseConnection conn = null;

        try {
            ConstructorInfo connCtor = Type.GetType( provider.ConnectionType).GetConstructor( new Type[] { typeof(string) });
            ConstructorInfo adapCtor = Type.GetType( provider.AdapterType ).GetConstructor( new Type[] { } );

            conn = new LazyDatabaseConnection( (IDbConnection)connCtor.Invoke( new object[] { provider.ConnectionString } ),
                                               (IDbDataAdapter)adapCtor.Invoke( null),
                                               provider.CloseDelay,
                                               provider.IsDistributed);
        } catch( Exception ex) {
            throw new DataAccessConnectionException( "Error attempting to create an object of type " + provider.ConnectionString, ex );
        }

        return conn;
    }
예제 #2
0
 public int IndexOf( ProviderConfigElement element)
 {
     return BaseIndexOf( element);
 }
예제 #3
0
 public void Remove( ProviderConfigElement element)
 {
     if( BaseIndexOf( element) >= 0)
         BaseRemove( element.Name);
 }
예제 #4
0
 public void Add( ProviderConfigElement element)
 {
     BaseAdd( element);
 }