c#LINQ to Entities无法识别方法'Boolean [英] c# LINQ to Entities does not recognize the method 'Boolean

查看:63
本文介绍了c#LINQ to Entities无法识别方法'Boolean的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 如何 地址下面的布尔方法。必须设置在线值。我得到的错误是 
 How to  address Boolean method below. The value Online has to be set. The error I get is 

推荐答案

可能此查询应该在SQL Server上执行,您的代码定义
IsConnectionValid 不可用。

提供有关此函数的详细信息,并考虑将其替换为可在SQL中执行的表达式。如果这是不可能的,那么执行
尚未计算 OnLine 的查询,将在稍后计算,如下所示:

Give details about this function and consider replacing it with some expression that can be executed in SQL. If this is not possible, then execute a query that does not yet calculate OnLine, wich will be calculated later, something like this:

foreach(var i in(来自db.Color中的a
         ;  
加入我的db.ColorClothes

        ;   上a.InstallationId
等于i.InstallationId

    &NBSP ;     
其中a.Id == Id

           
选择

    &NBSP ;   &n BSP;  
   new

                      
{

     
                   
ID = i.id,

                         
InstallationId = i.InstallationId

                      
})

                  
.ToList()

                  
。选择(z =>

          ; 
   new

              
{

    
          
ID = z.ID,

             
OnLine = Utilities.IsConnectionValid(z.InstallationId)

            
})

                   
))



foreach( var i in ( from a in db.Color
                    join i in db.ColorClothes
                    on a.InstallationId equals i.InstallationId
                    where a.Id == Id
                    select
                       new
                       {
                          ID = i.id,
                          InstallationId = i.InstallationId
                       } )
                   .ToList()
                   .Select( z =>
                       new
                       {
                          ID = z.ID,
                          OnLine = Utilities.IsConnectionValid(z.InstallationId)
                       } )
                    ) )


这篇关于c#LINQ to Entities无法识别方法'Boolean的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆