/// <summary> /// <para>Creates a connection for this database.</para> /// </summary> /// <remarks> /// This method has been overridden to support keeping a single connection open until you /// explicitly close it with a call to <see cref="CloseSharedConnection"/>. /// </remarks> /// <returns> /// <para>The <see cref="DbConnection"/> for this database.</para> /// </returns> /// <seealso cref="DbConnection"/> public override DbConnection CreateConnection() { DbConnection connection = SqlCeConnectionPool.CreateConnection(this); connection.ConnectionString = ConnectionString; return(connection); }
/// <summary> /// <para>Creates a connection for this database.</para> /// </summary> /// <remarks> /// This method has been overridden to support keeping a single connection open until you /// explicitly close it with a call to <see cref="CloseSharedConnection"/>. /// </remarks> /// <returns> /// <para>The <see cref="DbConnection"/> for this database.</para> /// </returns> /// <seealso cref="DbConnection"/> public override DbConnection CreateConnection() { using (DatabaseConnectionWrapper wrapper = SqlCeConnectionPool.CreateConnection(this)) { wrapper.AddRef(); wrapper.Connection.ConnectionString = ConnectionString; return(wrapper.Connection); } }
/// <summary> /// Gets a "wrapped" connection for use outside a transaction. /// </summary> /// <returns>The wrapped connection.</returns> protected override DatabaseConnectionWrapper GetWrappedConnection() { return(SqlCeConnectionPool.CreateConnection(this, true)); }