Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 向DateTime添加秒数的NHibernate.Linq查询问题_C#_Linq_Entity Framework_Nhibernate_Fluent Nhibernate - Fatal编程技术网

C# 向DateTime添加秒数的NHibernate.Linq查询问题

C# 向DateTime添加秒数的NHibernate.Linq查询问题,c#,linq,entity-framework,nhibernate,fluent-nhibernate,C#,Linq,Entity Framework,Nhibernate,Fluent Nhibernate,在使用NHibernate.Linq和Entity Framework 6.0时,我收到以下异常 NHibernate.QueryException:无法在没有投影的条件上使用子查询。 问题具体来自: taco.LastRun <= DbFunctions.AddSeconds(taco.LastRun, taco.PeriodSeconds) taco.LastRun我认为这是因为您正在更新select查询中的信息。 此更新本身将是某种查询(可能是update SQL语句) 尝试先更新

在使用NHibernate.Linq和Entity Framework 6.0时,我收到以下异常

NHibernate.QueryException:无法在没有投影的条件上使用子查询。

问题具体来自:

taco.LastRun <= DbFunctions.AddSeconds(taco.LastRun, taco.PeriodSeconds)

taco.LastRun我认为这是因为您正在更新select查询中的信息。
此更新本身将是某种查询(可能是update SQL语句)

尝试先更新信息,然后执行select查询

但是看看你想做什么并没有多大意义,就像

taco.lastrun0)。 但我想我知道你想做什么:

var results = (
from taco in Session.Linq<Taco>()
where
    taco.IsActive && !taco.IsProcessing &&
    ((taco.StartCrunching == null) || (taco.StartCrunching <= currentDateTime)) &&
    ((taco.Cycles == null) || (taco.CycleCount < taco.Cycles)) &&
    (taco.LastRun == null || (taco.LastRun <= currentDateTime.AddSeconds(taco.PeriodSeconds)))
    && ((taco.EndCrunching == null))
select taco).ToList();
var结果=(
来自会话中的taco.Linq()
哪里
taco.IsActive&!taco.IsProcessing&&

((Too.StcRunung==NULL)”(Too.StcRununGHD NHiBiNATE。Linq是非常非常老的。如果您还没有这样做,考虑升级到NHiBiNess 3.4或4,它是对LINQ的内置支持,这大大改进了。
var results = (
from taco in Session.Linq<Taco>()
where
    taco.IsActive && !taco.IsProcessing &&
    ((taco.StartCrunching == null) || (taco.StartCrunching <= currentDateTime)) &&
    ((taco.Cycles == null) || (taco.CycleCount < taco.Cycles)) &&
    (taco.LastRun == null || (taco.LastRun <= currentDateTime.AddSeconds(taco.PeriodSeconds)))
    && ((taco.EndCrunching == null))
select taco).ToList();