Exemplo n.º 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;
    }
Exemplo n.º 2
0
 public int IndexOf( ProviderConfigElement element)
 {
     return BaseIndexOf( element);
 }
Exemplo n.º 3
0
 public void Remove( ProviderConfigElement element)
 {
     if( BaseIndexOf( element) >= 0)
         BaseRemove( element.Name);
 }
Exemplo n.º 4
0
 public void Add( ProviderConfigElement element)
 {
     BaseAdd( element);
 }