Created
June 8, 2018 13:28
-
-
Save ssougnez/a93327f86fe595b498eb883477b3f540 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
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