asp.net-core - 使用 linq 从实体框架核心获取 {"error":"Null TypeMapping in Sql Tree"}
问题描述
我有这个 linq 选择语句,我得到了这个错误 {"error":"Null TypeMapping in Sql Tree"} 回来。
生病将代码放在下面,但有没有办法获得有关问题所在的更多信息?如果您需要这些实体,请告诉我,我会复制它们。
问候
var query = from o in _orderDataDbContext.tblSellFlangeOrders
join od in _orderDataDbContext.tblSellFlangeOrderDetails
on (int?)o.Id equals od.SellFlangeOrderId
join t in _orderDataDbContext.tblTypes
on od.TypeId equals (int?)t.Id
join l in _orderDataDbContext.VLegendeFlangeLengths
on od.LengthId equals (int?)l.Id
join g in _orderDataDbContext.VLegendeGrades
on od.GradeId equals (int?)g.Id
where o.Id == request._flangeOrderID
select new FlangeOrderDetailByPoCodeDto
{
SellFlangeOrderID = o.Id,
DetailID = od.Id,
Price = od.Price1000,
BF = od.Bf,
TypeID = t.Id,
Type = t.Inches1 + "x" + t.Inches2,
LengthID = l.Id,
Length = l.Length + "'" + l.OverLength + "\"",
GradeID = g.Id,
Grade = g.Grade
};
解决方案
在运行正常的代码中升级到 .net core 3.1 后,我遇到了类似的问题。
最后,问题就像您在这里遇到的那样:
Length = l.Length + "'" + l.OverLength + "\"",
似乎您无法连接 int、decimal 等...所以您必须将它们转换为字符串
Length = l.Length.ToString() + "'" + l.OverLength.ToString() + "\"",
推荐阅读
- python - 创建带有关联数据的 pip 可安装单模块包
- python - 如何对我在 Django 中过滤的每个对象使用不同的列表进行过滤(in=...)?
- c++ - 为什么“删除”运算符给我访问冲突
- google-cloud-platform - 将 gcloud 命令的输出重定向到云构建中的文件
- python-3.x - 从没有类名的单个 div 标签中提取多个图像链接
- r - R中的递归错误(斐波那契数列)
- python - 混合了浮点数和整数的列表的Ndarray?
- javascript - 延迟加载 Google 跟踪代码管理器
- c - 棕褐色过滤器 CS50 第 4 周
- ios - 如何在 Swift UI 中推送和弹出视图?