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
It is not a bug, we have special code which ignores CanBeNull for complex associations.
For what reason?
Also, QueryableAssociationTests.cs and some other tests use QueryExpressionMethod and CanBeNull combination.
Does it make performance isssues for your queries?
No, it doesn't. At least for now. It's more about correctness. I don't know what is the point of CanBeNull attribute, but I understand it as not like hint (CanBeNull = false, so I promise you that every Service references to Client"), but like forced requirement (CanBeNull = false, so I if any Service does not references to Client - skip it). Of course I can add where ... is not null, but it's not great workaround, as if association is changed later (like I just did), all queries using it should be fixed.
This looks like a dupe of #3658, which was supposedly fixed in 5.0.0.
I tested with SqlServer and Sqlite. Queries was slighly different, but I doubt it matters. CanBeNull with QueryExpressionMethod was ignored in both cases. CanBeNull with ExpressionPredicate was ignored in Sqlite, but not in SqlServer. It's weird.
Describe your issue
If
CanBeNull
is false, I would expect generated SQL to useINNER JOIN
orCROSS APPLY
. But it usesLEFT JOIN
orOUTER APPLY
instead.Steps to reproduce
Environment details
Linq To DB
version: 5.4.0Database (with version): SQL Server 2008
ADO.NET Provider (with version): Microsoft.Data.SqlClient 4.1.0
.NET Version: .NET Core 2.1
The text was updated successfully, but these errors were encountered: