public async Task Store(OutgoingMessage message, DateTime dueTime, string destination, SqlConnection connection, SqlTransaction transaction) { var messageRow = DelayedMessageRow.From(message.Headers, message.Body, dueTime, destination); using (var command = new SqlCommand(storeCommand, connection, transaction)) { messageRow.PrepareSendCommand(command); await command.ExecuteNonQueryAsync().ConfigureAwait(false); } }
public static DelayedMessageRow From(Dictionary <string, string> headers, byte[] body, DateTime due, string destination) { Guard.AgainstNull(nameof(destination), destination); var row = new DelayedMessageRow(); headers["NServiceBus.SqlServer.ForwardDestination"] = destination; row.headers = DictionarySerializer.Serialize(headers); row.bodyBytes = body; row.due = due; return(row); }