I have a button_click event. which support two methods if async-mode is ON.
So there's for example Update() method which are sync version
And UpdateAsync() method which are async version.
Now Lets see a btnEdit_Click which will call Update() if IsAsynchronous option Boolean is ON.
internal async void BtnEdit_ItemClick(object sender, ItemClickEventArgs e)
{
if (IsAsynchronousMode)
await crud.UpdateAsync(crud.DataBuffer);
else
crud.Update();
}
Now is this true what i made ? to make a Method can support both sync / async ? or this anti-pattern. but i assuming the C# events are by default sync. so i put async keyword in the main method.
Also implementation of UpdateAsync() is fine implemented. it call ADO.NET await ExecuteNonQueryAsync()
Sorry am so conflicting and need support both calls in one method. or which is better approach should i follow ?