先上代码:
var db = new db_picContext(); var u = db.DtUser.Find(338); int a = u.DtProject.Count(); int b = db.DtProject.Count(c => c.UploadUserId == u.Id); return Json(new { a, b });
运行结果:
{"a":0,"b":2}
是不是说明 Find 结果 u 并不能通过导航属性(外键)来获取关联表的内容?
引擎:Pomelo.EntityFrameworkCore.MySql
Metadata-file-could-not-be-found
aspnetcore-return-file
The-call-is-ambiguous-between-the-System-Linq-Queryable-and-System-Linq-AsyncEnumerable
map-doc
baidu-ditu-gl-usage