Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var hamilton = new Driver
{
FirstName = "Lewis",
LastName = "Hamilton",
ChampionTitleCount = 4
};
string sql = $@"INSERT INTO [Drivers] ([FirstName], [LastName], [ChampionTitleCount]) VALUES (@FirstName, @LastName, @ChampionTitleCount);
SELECT CAST(SCOPE_IDENTITY() AS int);";
hamilton.Id = (await connection.QueryAsync<int>(sql, hamilton)).FirstOrDefault();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.