[BUG]其中(x => x.XXXid = null)将不会被翻译。 [英] [BUG] Where( x=> x.XXXid = null) will not be translated.

查看:145
本文介绍了[BUG]其中(x => x.XXXid = null)将不会被翻译。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 

我的poco:

 

 

    public partial class PriceSegmentSetDetail

    {

        public int PriceSegmentSetDetailID { get; set; }

        public Nullable<int> PriceSegmentSetID { get; set; }

        public Nullable<int> PriceAssignmentDetailID { get; set; }

        public Nullable<System.DateTime> InsertDT { get; set; }

        public Nullable<int> InsertUserID { get; set; }

        public Nullable<System.DateTime> UpdateDT { get; set; }

        public Nullable<int> UpdateUserID { get; set; }

        public Nullable<int> SegmentGroupID { get; set; }

        public Nullable<int> Version { get; set; }



        public virtual PriceAssignmentDetail PriceAssignmentDetail { get; set; }

        public virtual MarketingSegmentGroup MarketingSegmentGroup { get; set; }

        public virtual PriceSegmentSet PriceSegmentSet { get; set; }

    }

 

 

  ;

我的查询:

DateTime? comparisonDate = context.PriceSegmentSetDetails

.Where(x => x.PriceAssignmentDetailID != null)

.Max(x => x.InsertDT);

生成的sql:

 

 

SELECT 

[GroupBy1].[A1] AS [C1]

FROM ( SELECT 

 MAX([Extent1].[InsertDT]) AS [A1]

 FROM [dbo].[PriceSegmentSetDetails] AS [Extent1]

)  AS [GroupBy1]

 

 

Where子句中的过滤器在哪里???

Where is the filter in Where clause???

 

我是用户实体框架4.2。

 

 

 

推荐答案

Hi Ziang;

Hi Ziang;

我用Code First构建了你的表,然后执行了你的确切查询。我完全得到一个不同的查询发送到服务器并在服务器上执行,看起来正确。您确定SQL语句是针对您发布的查询吗?

I built your table with Code First and then executed your exact query. I completely got a different query sent to and executed on the server and looks correct. Are you sure that the SQL statements is for the query you posted?

这是创建并发送到服务器的查询

This is the query that was created and sent to the server


SELECT 
[GroupBy1].[A1] AS [C1]
FROM ( SELECT 
	MAX([Extent1].[InsertDT]) AS [A1]
	FROM [dbo].[PriceSegmentSetDetails] AS [Extent1]
	WHERE [Extent1].[PriceAssignmentDetailID] IS NOT NULL
)  AS [GroupBy1]


这篇关于[BUG]其中(x =&gt; x.XXXid = null)将不会被翻译。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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