示例#1
0
 async Task UpdateLastReadTime(string id, IDbConnection connection)
 {
     using (var command = connection.CreateCommand())
     {
         command.CommandText = $"UPDATE [{_tableName}] SET [LastReadTime] = @now WHERE [Id] = @id";
         command.Parameters.Add("now", SqlDbType.DateTimeOffset).Value = RebusTime.Now;
         command.Parameters.Add("id", SqlDbType.VarChar, 200).Value    = id;
         await command.ExecuteNonQueryAsync();
     }
 }
示例#2
0
        static void ExecuteCommands(IDbConnection connection, string sqlCommands)
        {
            foreach (var sqlCommand in sqlCommands.Split(new[] { "----" }, StringSplitOptions.RemoveEmptyEntries))
            {
                using (var command = connection.CreateCommand())
                {
                    command.CommandText = sqlCommand;

                    Execute(command);
                }
            }
        }
 async Task UpdateLastReadTime(string id, IDbConnection connection)
 {
     using (var command = connection.CreateCommand())
     {
         command.CommandText = $"UPDATE [{_tableName}] SET [LastReadTime] = @now WHERE [Id] = @id";
         command.Parameters.Add("now", SqlDbType.DateTimeOffset).Value = RebusTime.Now;
         command.Parameters.Add("id", SqlDbType.VarChar, 200).Value = id;
         await command.ExecuteNonQueryAsync();
     }
 }