Entity Framework Core如何设置3个表联合查询(Join)

2020-12-22 18:32发布

问题:

目前我只会联合两个表,如:

var a = 【this.UserContentTable.Join(this.AreaTable】, _UserContentTable => _UserContentTable.AreaID, _AreaTable => _AreaTable.ID, (_UserContentTable, _AreaTable) => new AllAreaList_MapAreaID { AreaName = _AreaTable.AreaName, CategoryID = _UserContentTable.CategoryID, UserID = _UserContentTable.UserID, Title = _UserContentTable.Title, Date = _UserContentTable.Date, Content = _UserContentTable.Content });

回答1:

EF 三表Join,三表Left Join : http://m.tnblog.net/xiuxin/article/details/2743



回答2:

https://docs.microsoft.com/zh-cn/ef/core/querying/related-data/eager
按官方文档来练习