Last active
March 7, 2020 14:19
-
-
Save jernejk/05aaf1141224fc6e44dd89547a82fe1e 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 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