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