I have the following code using Dapper.SimpleCRUD :
var test = new FallEnvironmentalCondition[] {
new FallEnvironmentalCondition {Id=40,FallId=3,Environm
The problem is the ForEach method is not an asynchronous method. It will not await the Task returned by your lambda. Running that code will fire every task and not wait for completion of any of them.
General point: marking a lambda as async does not make a synchronous method you pass it into behave asynchronously.
Solution: you will need to use a foreach loop which awaits the tasks' completion.
eg: foreach (var x in xs) await f(x);
You can wrap that in a helper method if you prefer.
(I know it's an old question, but I don't think it was clearly answered)