Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Option 1 (with await)
- public async Task<AccountEntity> InsertAsync(AccountEntity item)
- {
- using (var connection = _connectionFactory.GetConnection())
- {
- connection.Open();
- var sql = @"
- INSERT INTO Account (UserName, Password)
- OUTPUT INSERTED.*
- VALUES (@UserName, @Password);";
- return await connection.QuerySingleAsync<AccountEntity>(sql, new { item.UserName, item.Password, });
- }
- }
Add Comment
Please, Sign In to add comment