我正在尝试调用GetScanningLogOnSettings()
,它查询ScanningDepartments
表以获取部门,然后创建 的实例ApplicationLogOnModel
,将查询的结果分配给 中的变量ApplicationLogOnModel
,并返回结果。
private ApplicationLogOnModel GetScanningLogOnSettings()
{
var mesEntity = new MESEntities();
var departments = from dept in mesEntity.ScanningDepartments
select dept.Department.ToList();
ApplicationLogOnModel depts = new ApplicationLogOnModel()
{
Department = departments
};
return depts;
}
它给了我:
“不能将类型隐式转换
'System.Linq.IQueryable<System.Collections.Generic.List<char>>
为'System.Collections.Generic.List<Models.Department>'
尝试转换为列表,但遇到了一些麻烦。