private FxDataAdapter() { FxProviderFactories.RegisterFactories(); _providerFactory = DbProviderFactories.GetFactory(FxDatabaseSettings.GetProviderInvariant()); _connection = _providerFactory.CreateConnection(); if (_connection != null) { _connection.ConnectionString = FxDatabaseSettings.GetConnectionString(); _dataAdapter = _providerFactory.CreateDataAdapter(); _commandBuilder = _providerFactory.CreateCommandBuilder(); _commandBuilder.DataAdapter = _dataAdapter; } else { throw new Exception("Connection not created"); } }
public static void RegisterFactories() { DbProviderFactories.RegisterFactory(FxDatabaseSettings.GetProviderInvariant(), FxDatabaseSettings.GetProviderType()); }