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/05aaf1141224fc6e44dd89547a82fe1e to your computer and use it in GitHub Desktop.
Save jernejk/05aaf1141224fc6e44dd89547a82fe1e to your computer and use it in GitHub Desktop.
public Task InsertTweetStoreProc(string username, string message, CancellationToken ct = default)
{
using (_logger.BeginScope(new Dictionary<string, object> { { "EFQueries", "InsertTweetStoreProc" } }))
{
_ = _context.Tweets
.FromSqlRaw(
"InsertTweet @Username, @Message",
new SqlParameter("Username", username),
new SqlParameter("Message", message))
// A hack to make STORE PROC work when they don't return anything.
.AsNoTracking()
.Select(x => new { })
.AsEnumerable()
.FirstOrDefault();
}
return Task.CompletedTask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment