You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//Fails for all dialects [Test]publicvoidCanUseStringEnumInConditional(){usingvarlog=newSqlLogSpy();varquery=db.Users.Where(user =>(user.Enum1==EnumStoredAsString.Small?EnumStoredAsString.Small:EnumStoredAsString.Large)==user.Enum1).Select(x =>x.Enum1);Assert.That(query.Count(),Is.GreaterThan(0));}//Fails for SQLite [Test]publicvoidCanUseStringEnumInConditional2(){usingvarlog=newSqlLogSpy();varquery=db.Users.Where(user =>(user.Enum1==EnumStoredAsString.Small?user.Enum1:EnumStoredAsString.Large)==user.Enum1).Select(x =>x.Enum1);Assert.That(query.Count(),Is.GreaterThan(0));}
Example of invalid SQL for CanUseStringEnumInConditional2 test on SQLite:
select
cast(count(user0_.Enum1) asINTEGER) as col_0_0_
from
Users user0_
where
cast(case
when user0_.Enum1=@p0 then user0_.Enum1
else @p1
end asINTEGER)=user0_.Enum1; -- cast to INTEGER is invalid as user0_.Enum1 is a string column
The problem goes away by removing the following transparent cast and returning case directly :
It's an old issue we discussed in #2499 (comment) and related to #707
Test cases for
WhereTests.cs
:Example of invalid SQL for
CanUseStringEnumInConditional2
test on SQLite:The problem goes away by removing the following transparent cast and returning case directly :
nhibernate-core/src/NHibernate/Linq/Visitors/HqlGeneratorExpressionVisitor.cs
Line 633 in 8e22b70
It's not a suggested fix - just a place to look at.
The text was updated successfully, but these errors were encountered: