Comments (8)
Also affects Any
with !=
this.Model.DbObjects.Any(x => x.Foo != "hello").ShouldBe(true);
// actually returns false
SELECT
(
SELECT CASE
WHEN ((EXISTS
(
SELECT "T0"."DbObjectId",
"T0"."Foo"
FROM "DbObject" AS "T0"
WHERE (("T0"."Foo") <> ('hello'))
)
)
) THEN
(1)
ELSE
(0)
END AS "EXISTS_COL"
) AS "value";
from shaolinq.
For reference, this is what EntityFramework 6 generates:
db.DbObjects.All(x => x.Foo == "hello"); // returns false
SELECT CASE
WHEN (NOT EXISTS
(
SELECT 1 AS [C1]
FROM [dbo].[DbObjects] AS [Extent1]
WHERE (NOT (
(N'hello' = [Extent1].[Foo])
AND ([Extent1].[Foo] IS NOT NULL)
)
)
OR (CASE
WHEN (N'hello' = [Extent1].[Foo]) THEN
CAST(1 AS BIT)
WHEN (NOT (
(N'hello' = [Extent1].[Foo])
AND ([Extent1].[Foo] IS NOT NULL)
)
) THEN
CAST(0 AS BIT)
END IS NULL
)
)
) THEN
CAST(1 AS BIT)
ELSE
CAST(0 AS BIT)
END AS [C1]
FROM
(SELECT 1 AS X) AS [SingleRowTable1];
db.DbObjects.Any(x => x.Foo != "hello"); // returns true
SELECT CASE
WHEN (EXISTS
(
SELECT 1 AS [C1]
FROM [dbo].[DbObjects] AS [Extent1]
WHERE NOT (
(N'hello' = [Extent1].[Foo])
AND ([Extent1].[Foo] IS NOT NULL)
)
)
) THEN
CAST(1 AS BIT)
ELSE
CAST(0 AS BIT)
END AS [C1]
FROM
(SELECT 1 AS X) AS [SingleRowTable1];
from shaolinq.
Could you add a unit test?
from shaolinq.
Will do
from shaolinq.
Unsurprisingly, the same issue can also apply to the predicates for Where
, Count
, etc...
from shaolinq.
TLDR but is this is an issue with SQL server only or all providers?
from shaolinq.
Affects both SQL server and sqlite, haven't tried mysql or postgres
from shaolinq.
Yeah comparing with null is undefined so not(undefined) isn't true.
I have to have a think about where else this affects could affect the framework because LINQ semantics for NULL is different.
from shaolinq.
Related Issues (20)
- AsyncRewrite ignores `override` keyword when the inheritance level is more than three
- Examples aren't working
- Project status HOT 7
- issue running under .net core 5.0 HOT 2
- Shaolinq broken with NpgSql > 6.0
- AsyncRewriter generates invalid code within a lock
- Started getting weird exception HOT 5
- Postgres CreateAsync (IfDatabaseNotExist) seems broken
- Bug(?): Multiple relations between the same tables with Backreference cause Exception
- MySqlException "Invalid attempt to Read when reader is closed." HOT 6
- Predicate based Delete fails if join is used HOT 1
- AsyncRewriter - Null conditional extension method call in async method breaks build
- AsyncWriter doesn't support nested functions
- there is no clear documentation of this package HOT 1
- Incorrect ordering with Include, OrderBy and Skip/Take
- AfterCommit DataAccessModelHook HOT 2
- Exception has occurred: CLR/System.IO.FileLoadException HOT 5
- Inconsistencies in changed properties on data model hook callbacks
- Doesn't seem to work with new version of ngpsql HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shaolinq.