我无法解决这个错误。我要参加另一个开发人员项目,他使用提供的代码检索了一些报告和应有的所有功能,但是当我创建类似的报告时,标题中总是出现错误。
为了使此映射正常工作,需要在何处以及在什么地方进行部署。请告知是否需要更多代码。还请注意,这是一个ASP.NET MVC 3应用程序
控制器...
case ReportType.BS_Report:
{
model.BSReport = "Company name";
var records = _docsRepo.PaginatedBS_Reports(model.BSReport,
model.From,
model.To,
currentPageIndex,
pageSize,
out totalRecords);
var TimeRec = Mapper.Map<IList<BS_Report>, IList<BSModel>>(records);
var TimeRecdModel = TimeRec.ToReportPagedList(currentPageIndex,
pageSize,
model,
totalRecords);
return PartialView("BS_Report", TimeRecdModel);
}
一切都按预期进行,直到到达这条线为止。
var TimeRec = Mapper.Map<IList<BS_Report>, IList<BSModel>>(records);
BS_Report类...
public class BS_Report : ReportBase
{
public int Id { get; set; }
public string EquipmentID { get; set; }
public string EquipmentDescription { get; set; }
public DateTime? CreatedOn { get; set; }
public string CustomerName { get; set; }
}
BS模型...
public class BSModel : ReportBaseModel
{
public int Id { get; set; }
public string EquipmentID { get; set; }
public string EquipmentDescription { get; set; }
public DateTime? CreatedOn { get; set; }
public string CustomerName { get; set; }
}
其他报告案例使用完全相同的代码...
case ReportType.Full_Report:
{
var records = _docsRepo.PaginatedFullReportReports(model.ReportedOn,
model.From,
model.To,
currentPageIndex,
pageSize,
out totalRecords);
var TimeRecord = Mapper.Map<IList<FullReport>, IList<FullReportModel>>(records);
var TimeRecordModel = TimeRecord.ToReportPagedList(currentPageIndex,
pageSize,
model,
totalRecords);
return PartialView("FullReport", TimeRecordModel);
}
您可能需要为新报告“创建”映射。在代码库中搜索对“ CreateMap”的一些调用,这些调用可以在以前的开发人员使用的任何报告类型上进行操作。您可能需要为您的BS_Report
类型创建一个。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句