Hi, really enjoying the Auto Query features of ss. However I’ve hit an issue when using the AutoCrud feature from within an MVC Controller Action. I think I have things wired up corrected as when I run the (auto) Crud service ‘CreateCrudPerson’ from Application_Start it works great, including the Audit events. When I check my database the entries are there correctly.
However, when I run the Crud service from the Contact action in the Home controller, it seems to hang the database. Please see example project here https://github.com/simonwebber/sscrudissue.git
The issue is because you’re trying to call AutoQuery’s Async Services from a Sync MVC Controller, effectively preventing the async Task’s continuation from being invoked.
You’ll need to use the Async Service Gateway APIs in Async MVC Actions instead, e.g:
public async Task<ActionResult> Contact()
{
ViewBag.Message = "Your contact page.";
var result = await Gateway.SendAsync(new CreateCrudPerson {
Name = "FromContact"
});
return View();
}
In future when submitting repo’s, please just the publish the project source code in a GitHub repo without the bin and obj folders so the project can be viewed directly in GitHub without needing to download & extract large .zip. GitHub enables better visibility, e.g. can be annotated & linked to & fixes via PR’s.
It’s also safer as the NuGet packages can be restored directly from NuGet, instead of needing to locally scan untrusted binaries.