【发布时间】:2019-03-01 07:31:56
【问题描述】:
我有这个代码:
public ActionResult Details(string id, string detailsDate)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var tblPersonnel = new tblPersonnel();
using (var _context = new ScalehouseModel()) // for disposing
{
tblPersonnel = _context.tblPersonnels.Find(id);
}
if (tblPersonnel == null)
{
return HttpNotFound();
}
Mapper.Initialize(config => config.CreateMap<tblPersonnel, PersonnelDetailsVm>());
PersonnelDetailsVm person = Mapper.Map<tblPersonnel, PersonnelDetailsVm>(tblPersonnel);
.... // and more but the error happens on the line above.
}
ajax 成功后,我将重定向到详细信息页面,您可以在上面看到该操作。我遇到这样的运行时错误:
我研究了this 并处理了我的 EF,但仍然无法正常工作并出现同样的错误。
我需要做什么来解决这个问题?
【问题讨论】:
标签: c# asp.net-mvc automapper