当前位置: 代码迷 >> C# >> Iqueryable.join语法如何写
  详细解决方案

Iqueryable.join语法如何写

热度:759   发布时间:2016-05-05 03:46:17.0
Iqueryable.join语法怎么写

var resolveExpress = 
                    db.ResolveExpress.Where(c => c.ResolveType != 0) 
                    .Join(db.ResolveType,
                    resolveExpresss => resolveExpresss,
                    resolveType => resolveType.ResolveType1,
                   (resolveExpresss, resolveType) => 
                    new { id= resolveExpresss.ResolveID,title= resolveType.ResolveTitle });

2个表 resolveExpress 和ResolveType

db.ResolveExpress.Where(c => c.ResolveType != 0) 取出第一张表 然后做链接 另个一表ResolveType 

连接条件安ResolveExpress.ResolveType=ResolveType.resolveType1

怎么 用db.ResolveExpress.Where(c => c.ResolveType != 0) .Join(后边参数怎么写

我这样写为什么是错的  提示:无法推倒出方法的类型实参,请尝试显示指定
 var resolveExpress = db.ResolveExpress.Where(c => c.ResolveType != 0)
                                        .Join(db.ResolveType,
                                        resolveExpresss => resolveExpresss,
                                        resolveType => resolveType.ResolveType1,
                                        (resolveExpresss, resolveType) =>
                                                                 new { id=                       resolveExpresss.ResolveID,title= resolveType.ResolveTitle });
------解决思路----------------------
.Join<..., ...>(...) 这里需要显式指定类型参数
  相关解决方案