“对象引用未设置为对象的实例”在运行迁移时收到此错误这是Employee Model Service接口
public IEnumerable<Employee> GetEmployees(string name)
{
return string.IsNullOrEmpty(name) ? UnitOfWork.EmployeeRepository.GetAll() : UnitOfWork.EmployeeRepository.GetAll().Where(c => c.Name == name);
}
这是员工服务代码
public JsonResult GetEmployees()
{
try
{
IEnumerable<Employee> employee = _employeeService.GetEmployees().ToList();
IEnumerable<EmployeeListViewModel> viewModelListEmployee=
Mapper.DynamicMap<IEnumerable<Employee>, IEnumerable<EmployeeListViewModel>>(employee);
return new JsonSuccessResult(viewModelListEmployee);
}
catch (Exception ex)
{
Response.StatusCode = (int)ResponseCode.UnprocessableEntity;
return new JsonErrorResult(ex.ToString());
}
}
此员工控制器发生错误
onKeyDown = function(event){
console.log('KEY: ' + event.which);
if (event.which == 250 || event.which == 229) {
event.preventDefault();
}
};
请有人详细说明为什么我从这段代码中得到这个错误???任何帮助将不胜感激。