Last active
June 14, 2018 06:31
-
-
Save jonasdw/948635ea043e76d2d4439daa6149b830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Add(MessageLog message) | |
{ | |
using (var conn = _connectionFactory.OpenConnection()) | |
{ | |
conn.Execute( | |
"INSERT INTO logs VALUES (" + | |
"@Id," + | |
"@Name," + | |
"@Payload::jsonb," + | |
"@Metadata," + | |
"@RaiseDate)", | |
message | |
); | |
} | |
// the order of adding is not preserved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach (var @event in c.RecordedEvents) | |
{ | |
psqlLogs.Add(new MessageLog | |
{ | |
Id = Guid.NewGuid(), | |
Metadata = "", | |
Name = @event.GetType().Name, | |
Payload = JsonConvert.SerializeObject(@event), | |
RaiseDate = DateTime.Now | |
}); | |
} | |
// when debugging | |
// i have three items in c.RecordedEvents lets call them A, B and C |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment