赞
踩
我有一个使用EFCore的ASP.NET Core网站。我想做一些工作,例如登录到数据库,但是在将响应发送给用户以便更快回答之后。
我可以在其他线程中执行此操作,但是由于对DbContext的异步访问,我不确定它是否安全。有什么推荐的方法吗?
public async TaskRequest([FromForm]RequestViewModel model, string returnUrl = null) { try { var newModel = new ResponseViewModel(model); // Some work return View("RequestView",newModel) } finally { // Some analysis on the request // I would like to defer this part await Log(model); } }
原因之一是我想调用一个Web服务(地理编码),它不需要回答,但是可以很好地处理日志(我需要坐标的城市/国家/地区)。
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。