private void SaveEvent(ISourcedEvent evnt, SqlTransaction transaction)
{
Contract.Requires<ArgumentNullException>(evnt != null, "The argument evnt could not be null.");
Contract.Requires<ArgumentNullException>(transaction != null, "The argument transaction could not be null.");
var bag = _converter.Convert(evnt);
byte[] data = ToBinary(bag);
using (var command = new SqlCommand(InsertNewEventQuery, transaction.Connection))
{
command.Transaction = transaction;
command.Parameters.AddWithValue("EventId", evnt.EventIdentifier);
command.Parameters.AddWithValue("EventSourceId", evnt.EventSourceId);
command.Parameters.AddWithValue("Name", evnt.GetType().FullName);
command.Parameters.AddWithValue("Sequence", evnt.EventSequence);
command.Parameters.AddWithValue("Data", data);
command.ExecuteNonQuery();
}
}