Skip to content

Instantly share code, notes, and snippets.

@jernejk
Last active March 7, 2020 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jernejk/5d473f9c2fb2a1b6ae71d73175930735 to your computer and use it in GitHub Desktop.
Save jernejk/5d473f9c2fb2a1b6ae71d73175930735 to your computer and use it in GitHub Desktop.
public async Task InsertTweet(string username, string message, CancellationToken ct = default)
{
using (_logger.BeginScope(new Dictionary<string, object> { { "EFQueries", "InsertTweet" } }))
{
_context.Tweets.Add(new Tweet
{
Username = username,
Message = message,
CreatedUtc = DateTime.UtcNow
});
await _context.SaveChangesAsync(ct);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment