I have a simple query that generates some odd SQL translations that explode my code when an object is saturated.
from x in DataContext.MyEntities
select new
{
IsTypeCDA = x.EntityType == "CDA"
}
I expect this request should translate to:
SELECT (CASE WHEN [t0].[EntityType] = @p1 THEN 1 ELSE 0 END) as [IsTypeCDA]
...
Instead, I get the following:
SELECT
(CASE
WHEN @p1 = [t0].[EntityType] THEN 1
WHEN NOT (@p1 = [t0].[EntityType]) THEN 0
ELSE NULL
END) AS [IsTypeCDA]
...
Since I saturate POCO, where it IsTypeCDAis bool, it explodes, stating that I can not appoint null bool.
Any thoughts?
Edit: fixed property names to make sense ...
source
share