ReloadAsync() private method

private ReloadAsync ( System.Data.OleDb.OleDbConnection connection, System.Data.OleDb.OleDbTransaction transaction ) : System.Threading.Tasks.Task
connection System.Data.OleDb.OleDbConnection
transaction System.Data.OleDb.OleDbTransaction
return System.Threading.Tasks.Task
Exemplo n.º 1
0
        /// <summary>
        /// Creates and opens a SQL connection.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns></returns>
        /// <remarks>
        /// The caller of this method is responsible for closing the connection.
        /// </remarks>
        private async Task<OleDbConnection> CreateConnectionAsync(CancellationToken cancellationToken = default(CancellationToken))
        {
            var con = new OleDbConnection(ConnectionString);
            await con.OpenAsync(cancellationToken).ConfigureAwait(false);

            if (m_ServerDefaultSettings == null)
            {
                var temp = new SqlServerEffectiveSettings();
                await temp.ReloadAsync(con, null);
#if !Thread_Missing
                Thread.MemoryBarrier();
#endif 
                m_ServerDefaultSettings = temp;
            }

            var sql = BuildConnectionSettingsOverride();

            if (sql.Length > 0)
                using (var cmd = new OleDbCommand(sql.ToString(), con))
                    await cmd.ExecuteNonQueryAsync();

            return con;
        }
Exemplo n.º 2
0
 public async Task<SqlServerEffectiveSettings> GetEffectiveSettingsAsync()
 {
     var result = new SqlServerEffectiveSettings();
     using (var con = await CreateConnectionAsync())
         await result.ReloadAsync(con, null);
     return result;
 }