diff --git a/src/Dapper.Contrib/SqlMapperExtensions.Async.cs b/src/Dapper.Contrib/SqlMapperExtensions.Async.cs index c93e39a4..5fcfaa05 100644 --- a/src/Dapper.Contrib/SqlMapperExtensions.Async.cs +++ b/src/Dapper.Contrib/SqlMapperExtensions.Async.cs @@ -136,7 +136,7 @@ private static async Task> GetAllAsyncImpl(IDbConnection conne /// Number of seconds before command execution timeout /// The specific ISqlAdapter to use, auto-detected based on connection if null /// Identity of inserted entity - public static Task InsertAsync(this IDbConnection connection, T entityToInsert, IDbTransaction transaction = null, + public async static Task InsertAsync(this IDbConnection connection, T entityToInsert, IDbTransaction transaction = null, int? commandTimeout = null, ISqlAdapter sqlAdapter = null) where T : class { var type = typeof(T); @@ -188,13 +188,13 @@ public static Task InsertAsync(this IDbConnection connection, T entityTo if (!isList) //single entity { - return sqlAdapter.InsertAsync(connection, transaction, commandTimeout, name, sbColumnList.ToString(), + return await sqlAdapter.InsertAsync(connection, transaction, commandTimeout, name, sbColumnList.ToString(), sbParameterList.ToString(), keyProperties, entityToInsert); } //insert list of entities var cmd = $"INSERT INTO {name} ({sbColumnList}) values ({sbParameterList})"; - return connection.ExecuteAsync(cmd, entityToInsert, transaction, commandTimeout); + return await connection.ExecuteAsync(cmd, entityToInsert, transaction, commandTimeout); } ///