我正在使用EF6执行CRUD操作。我需要在两个表中插入数据,它按预期工作,但在函数本身下面需要3秒钟。我不知道为什么,但我需要弄清楚并缩短这段时间。
public int SaveRequestDetails(RequestEntity requestEntity)
{
try
{
if (requestEntity != null)
{
Request request = new Request();
request.SourceMessageXML = requestEntity.SourceMessageXml;
request.RequestMessageXml = requestEntity.RequestMessageXml;
request.CreatedDate = DateTime.UtcNow;
RequestDetails requestDetail = new RequestDetails();
requestDetail.ClientFlag = false;
requestDetail.CreatedDate = DateTime.UtcNow;
requestDetail.RequestDateTime = DateTime.UtcNow;
requestDetail.EmailFlag = false;
request.RequestDetails.Add(requestDetail);
_unitOfWork.RequestRepository.Insert(request);
_unitOfWork.Save();
}
}
catch (Exception ex)
{
}
}
非常感谢任何帮助。提前致谢。