Here are the examples of the csharp api class System.Data.Common.DbConnection.Open() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
1. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: MsSQLStorage.cs
Source File: MsSQLStorage.cs
public override void Connect_To_Database(StorageConfig config) { myConfig = config as MsSQLConfig; if (myConfig == null) throw new Exception("Database Config is NULL"); try { myDBConn = new SqlConnection(ConnectionString); myDBConn.Open(); if (myDBConn.State != System.Data.ConnectionState.Open) throw new Exception("Unable to Open Database. Storage:" + config.Name); } catch (SqlException ex) { throw ex; } catch (Exception ex) { throw ex; } }
0
2. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: MsSQLStorage.cs
Source File: MsSQLStorage.cs
private void CheckAndEstablishReadConnection() { if (readDBConn == null) { readDBConn = new SqlConnection(ConnectionString); readDBConn.Open(); } }
0
3. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: MySQLStorage.cs
Source File: MySQLStorage.cs
public override void Connect_To_Database(StorageConfig config) { myConfig = config as MySQLConfig; if (myConfig == null) throw new Exception("Database Config is NULL"); try { myDBConn = new MySqlConnection(ConnectionString); myDBConn.Open(); if (myDBConn.State != System.Data.ConnectionState.Open) throw new Exception("Unable to Open Database. Storage:" + config.Name); } catch (Exception ex) { throw ex; } }
0
4. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: PostgreSQLStorage.cs
Source File: PostgreSQLStorage.cs
public override void Connect_To_Database(StorageConfig config) { myConfig = config as PostgreSQLConfig; if (myConfig == null) throw new Exception("Database Config is NULL"); try { myDBConn = new Npgsql.NpgsqlConnection(ConnectionString); myDBConn.Open(); if (myDBConn.State != System.Data.ConnectionState.Open) throw new Exception("Unable to Open Database. Storage:" + config.Name); } catch (Exception ex) { throw ex; } }
0
5. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: SQLLiteStorage.cs
Source File: SQLLiteStorage.cs
private void CheckAndEstablishReadConnection() { if (readDBConn == null) { readDBConn = new SQLiteConnection(ConnectionString); readDBConn.Open(); } }
0
6. Example
Project: nesper
Source File: DbDriverODBC.cs
Source File: DbDriverODBC.cs
public override DbConnection CreateConnection() { DbConnection dbConnection = new OdbcConnection(ConnectionString); dbConnection.Open(); return dbConnection; }
0
7. Example
Project: nesper
Source File: DbDriverSqlServer.cs
Source File: DbDriverSqlServer.cs
public override DbConnection CreateConnection() { DbConnection dbConnection = new SqlConnection(ConnectionString); dbConnection.Open(); return dbConnection; }
0
8. Example
Project: fluentmigrator
Source File: SQLiteSchemaDumpTests.cs
Source File: SQLiteSchemaDumpTests.cs
[SetUp] public void Setup() { Connection = new SQLiteConnection(IntegrationTestOptions.SqlLite.ConnectionString); Processor = new SqliteProcessor(Connection, new SqliteGenerator(), new TextWriterAnnouncer(System.Console.Out), new ProcessorOptions(), new SqliteDbFactory()); SchemaDumper = new SqliteSchemaDumper(Processor, new TextWriterAnnouncer(System.Console.Out)); Connection.Open(); }
0
9. Example
Project: RawDataAccessBencher
Source File: L2SBencherDataContext.cs
Source File: L2SBencherDataContext.cs
private DbCommand SetupCommand(DbCommand toSetup, bool openConnection) { if(toSetup==null) { return toSetup; } toSetup.Connection = this.Connection; toSetup.Transaction = this.Transaction; toSetup.CommandTimeout = this.CommandTimeout; if((toSetup.Connection!=null) && openConnection && (toSetup.Connection.State!=ConnectionState.Open)) { toSetup.Connection.Open(); } return toSetup; }
0
10. Example
Project: Glimpse
Source File: GlimpseDbConnection.cs
Source File: GlimpseDbConnection.cs
public override void Open() { InnerConnection.Open(); }
0
11. Example
Project: efprs
Source File: UnitOfWork.cs
Source File: UnitOfWork.cs
private void OpenConnection() { if (((IObjectContextAdapter)_dbContext).ObjectContext.Connection.State != ConnectionState.Open) { ((IObjectContextAdapter)_dbContext).ObjectContext.Connection.Open(); } }
0
12. Example
Project: efprs
Source File: UnitOfWork.cs
Source File: UnitOfWork.cs
private void OpenConnection() { if (_objectContext.Connection.State != ConnectionState.Open) { _objectContext.Connection.Open(); } }
0
13. Example
Project: efprs
Source File: UnitOfWork.cs
Source File: UnitOfWork.cs
private void OpenConnection() { if (((IObjectContextAdapter)_dbContext).ObjectContext.Connection.State != ConnectionState.Open) { ((IObjectContextAdapter)_dbContext).ObjectContext.Connection.Open(); } }
0
14. Example
Project: Craig-s-Utility-Library
Source File: DbCommandExtensions.cs
Source File: DbCommandExtensions.cs
public static DbCommand Open(this DbCommand Command) { if (Command != null && Command.Connection != null && Command.Connection.State != ConnectionState.Open) Command.Connection.Open(); return Command; }
0
15. Example
Project: Craig-s-Utility-Library
Source File: DbCommandExtensions.cs
Source File: DbCommandExtensions.cs
public static DbCommand Open(this DbCommand Command) { if (Command != null && Command.Connection != null && Command.Connection.State != ConnectionState.Open) Command.Connection.Open(); return Command; }
0
16. Example
Project: Sequelocity.NET
Source File: SequelocityDotNet.cs
Source File: SequelocityDotNet.cs
public static DbCommand OpenConnection( this DbCommand dbCommand ) { if ( dbCommand.Connection.State != ConnectionState.Open ) { dbCommand.Connection.Open(); } return dbCommand; }
0
17. Example
Project: ActivityManager
Source File: SqlDataSource.cs
Source File: SqlDataSource.cs
public void SqlOpenConnection() { if (connection.State == System.Data.ConnectionState.Closed) connection.Open(); permanent_connection = true; }
0
18. Example
Project: dotnetmigrations
Source File: DataAccess.cs
Source File: DataAccess.cs
public void OpenConnection() { _connection.Open(); }
0
19. Example
Project: ALinq
Source File: Connection.cs
Source File: Connection.cs
public override void Open() { source.Open(); }
0
20. Example
Project: referencesource
Source File: DBConnection.cs
Source File: DBConnection.cs
public virtual Task OpenAsync(CancellationToken cancellationToken) { TaskCompletionSource<object> taskCompletionSource = new TaskCompletionSource<object>(); if (cancellationToken.IsCancellationRequested) { taskCompletionSource.SetCanceled(); } else { try { Open(); taskCompletionSource.SetResult(null); } catch (Exception e) { taskCompletionSource.SetException(e); } } return taskCompletionSource.Task; }
0
21. Example
Project: SQLiteCodeFirst
Source File: MemoryDbTest.cs
Source File: MemoryDbTest.cs
[TestMethod] public void CreateInMemoryDatabaseTest() { using (DbConnect/n ..... /n //View Source file for more details /n }
0
22. Example
Project: ArcBruTile
Source File: DbCache.cs
Source File: DbCache.cs
private bool OpenConnectionIfClosed() { if (Connection.State != ConnectionState.Open) { Connection.Open(); return true; } return false; }
0
23. Example
Project: VoxelSim
Source File: BasicDataServiceTest.cs
Source File: BasicDataServiceTest.cs
protected virtual DbConnection Connect() { DbConnection cnn = new TConn(); cnn.ConnectionString = m_connStr; cnn.Open(); return cnn; }
0
24. Example
Project: opensimulator
Source File: BasicDataServiceTest.cs
Source File: BasicDataServiceTest.cs
protected virtual DbConnection Connect() { DbConnection cnn = new TConn(); cnn.ConnectionString = m_connStr; cnn.Open(); return cnn; }
0
25. Example
Project: NServiceKit
Source File: ProfiledDbConnection.cs
Source File: ProfiledDbConnection.cs
public override void Open() { if (_conn.State != ConnectionState.Open) _conn.Open(); }
0
26. Example
Project: initialround
Source File: DataController.cs
Source File: DataController.cs
public static Models.Contexts.DbContext CreateDbContext(string connectionString) { Models.Contexts.DbContext context = new Models.Contexts.DbContext(connectionString); ((IObjectContextAdapter)context).ObjectContext.Connection.Open(); return context; }
0
27. Example
Project: Susanoo
Source File: DatabaseManager.cs
Source File: DatabaseManager.cs
protected virtual void OpenConnectionInternal() { if (Connection.State != ConnectionState.Open) Connection.Open(); }
0
28. Example
Project: Radical
Source File: DbConnectionWrapper.cs
Source File: DbConnectionWrapper.cs
public override void Open() { if( this.WrappedConnection.State == ConnectionState.Closed ) { this.WrappedConnection.Open(); } }
0
29. Example
Project: framework
Source File: Transaction.cs
Source File: Transaction.cs
public void Start() { if (!Started) { Connection = Connector.Current.CreateConnection(); Connection.Open(); //Transaction = Connection.BeginTransaction(IsolationLevel ?? con.IsolationLevel); Started = true; } }
0
30. Example
Project: SubSonic-2.0
Source File: SubSonicRepository.cs
Source File: SubSonicRepository.cs
public bool IsOnline() { bool result = false; using(DbConnection conn=this.Provider.CreateConnection()){ try { conn.Open(); result = true; } catch { result = false; } } return true; }
0
31. Example
Project: SubSonic-2.0
Source File: SubSonicRepository.cs
Source File: SubSonicRepository.cs
public bool IsOnline(string connectionString) { bool result = false; using (DbConnection conn = this.Provider.CreateConnection(connectionString)) { try { conn.Open(); result = true; } catch { result = false; } } return true; }
0
32. Example
Project: DNTProfiler
Source File: ProfiledDbConnection.cs
Source File: ProfiledDbConnection.cs
public override void Open() { _profiler.ConnectionOpened(InnerConnection, NHProfilerContextProvider.GetLoggedDbConnection(InnerConnection)); InnerConnection.Open(); }
0
33. Example
Project: Glimpse.Nancy
Source File: ConnectionManager.cs
Source File: ConnectionManager.cs
public IDbConnection GetConnection() { var conn = this.factory.CreateConnection(); conn.ConnectionString = @"Data Source=" + this.databaseName; conn.Open(); return conn; }
0
34. Example
Project: InvokeQueryPowershellModule
Source File: InvokeQueryBase.cs
Source File: InvokeQueryBase.cs
protected virtual DbConnection GetDbConnection() { var connection = ProviderFactory.CreateConnection(); if (connection == null) { throw new ApplicationException("Unable to create conneciton. Please make sure all DLL libraries have been installed."); } connection.ConnectionString = ConnectionString; connection.Open(); return connection; }
0
35. Example
Project: Wexflow
Source File: Sql.cs
Source File: Sql.cs
void ExecSql(DbConnection conn, DbCommand comm) { conn.Open(); comm.ExecuteNonQuery(); }
0
36. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: MySQLStorage.cs
Source File: MySQLStorage.cs
private void CheckAndEstablishReadConnection() { if (readDBConn == null) { readDBConn = new MySqlConnection(ConnectionString); readDBConn.Open(); readDBConn.ChangeDatabase(myConfig.Database); } }
0
37. Example
Project: DotNetSiemensPLCToolBoxLibrary
Source File: PostgreSQLStorage.cs
Source File: PostgreSQLStorage.cs
private void CheckAndEstablishReadConnection() { if (readDBConn == null) { readDBConn = new NpgsqlConnection(ConnectionString); readDBConn.Open(); readDBConn.ChangeDatabase(myConfig.Database); } }
0
38. Example
Project: EDDiscovery
Source File: SQLiteConnectionED.cs
Source File: SQLiteConnectionED.cs
private static bool DbFactoryWorks(DbProviderFactory factory) { if (factory != null) { try { using (var conn = factory.CreateConnection()) { conn.ConnectionString = "Data Source=:memory:;Pooling=true;"; conn.Open(); return true; } } catch { } } return false; }
0
39. Example
Project: nesper
Source File: DbDriverGeneric.cs
Source File: DbDriverGeneric.cs
public override DbConnection CreateConnection() { try { DbConnection dbConnection = dbProviderFactory.CreateConnection(); dbConnection.ConnectionString = ConnectionString; dbConnection.Open(); return dbConnection; } catch (DbException ex) { String detail = "DbException: " + ex.Message + " VendorError: " + ex.ErrorCode; throw new DatabaseConfigException( "Error obtaining database connection using connection-string '" + ConnectionString + "' with detail " + detail, ex); } }
0
40. Example
Project: nesper
Source File: DbDriverMySQL.cs
Source File: DbDriverMySQL.cs
public override DbConnection CreateConnection() { DbConnection dbConnection = dbProviderFactory.CreateConnection(); dbConnection.ConnectionString = ConnectionString; dbConnection.Open(); return dbConnection; }
0
41. Example
Project: nesper
Source File: DbDriverGeneric.cs
Source File: DbDriverGeneric.cs
public override DbConnection CreateConnection() { try { DbConnection dbConnection = dbProviderFactory.CreateConnection(); dbConnection.ConnectionString = ConnectionString; dbConnection.Open(); return dbConnection; } catch (DbException ex) { String detail = "DbException: " + ex.Message + " VendorError: " + ex.ErrorCode; throw new DatabaseConfigException( "Error obtaining database connection using connection-string '" + ConnectionString + "' with detail " + detail, ex); } }
0
42. Example
Project: nesper
Source File: DbDriverMySQL.cs
Source File: DbDriverMySQL.cs
public override DbConnection CreateConnection() { DbConnection dbConnection = dbProviderFactory.CreateConnection(); dbConnection.ConnectionString = ConnectionString; dbConnection.Open(); return dbConnection; }
0
43. Example
Project: PeanutButter
Source File: TempDB.cs
Source File: TempDB.cs
private DbConnection CreateOpenDatabaseConnection() { var connection = Activator.CreateInstance(typeof (TDatabaseConnection), ConnectionString) as DbConnection; if (connection != null) { connection.Open(); return connection; } else throw new InvalidOperationException($"Unable to instantate connection of type {typeof(TDatabaseConnection)} as a DbConnection"); }
0
44. Example
Project: RawDataAccessBencher
Source File: Massive.cs
Source File: Massive.cs
public virtual DbConnection OpenConnection() { var result = _factory.CreateConnection(); result.ConnectionString = ConnectionProfile.ConnectionString; result.Open(); return result; }
0
45. Example
Project: RawDataAccessBencher
Source File: Massive.cs
Source File: Massive.cs
public virtual DbConnection OpenConnection() { var result = _factory.CreateConnection(); result.ConnectionString = ConnectionString; result.Open(); return result; }
0
46. Example
Project: WPFCrudControl
Source File: UnitOfWork.cs
Source File: UnitOfWork.cs
public void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified) { _objectContext = ((IObjectContextAdapter)_dataContext).ObjectContext; if (_objectContext.Connection.State != ConnectionState.Open) { _objectContext.Connection.Open(); } _transaction = _objectContext.Connection.BeginTransaction(isolationLevel); }
0
47. Example
Project: EntityFramework.CommonTools
Source File: TestInitializer.cs
Source File: TestInitializer.cs
[TestInitialize] public void TestInitialize() { _connection = new SQLite/n ..... /n //View Source file for more details /n }
0
48. Example
Project: Sequelocity.NET
Source File: SequelocityDotNet.cs
Source File: SequelocityDotNet.cs
public static bool TestConnection( this DatabaseCommand databaseCommand ) { try { databaseCommand.DbCommand.Connection.Open(); databaseCommand.DbCommand.Connection.Close(); return true; } catch ( Exception ) { return false; } }
0
49. Example
Project: URF
Source File: UnitOfWork.cs
Source File: UnitOfWork.cs
public virtual void BeginTransaction(IsolationLevel isolationLevel = IsolationLevel.Unspecified) { var objectContext = ((IObjectContextAdapter) _context).ObjectContext; if (objectContext.Connection.State != ConnectionState.Open) { objectContext.Connection.Open(); } Transaction = objectContext.Connection.BeginTransaction(isolationLevel); }
0
50. Example
Project: Lidarr
Source File: DataMapper.cs
Source File: DataMapper.cs
protected internal void OpenConnection() { OnOpeningConnection(); if (Command.Connection.State != ConnectionState.Open) Command.Connection.Open(); }