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
Comparing nullable owned entity to null in Select methods returns incorrect result - the null comparison returns true even when the owned entity exists.
Steps to reproduce
Having model with Owner and Owned classes
/// <summary>/// Owner/// </summary>publicclassOwner{/// <summary>/// Id of the owner/// </summary>publicintId{get;set;}/// <summary>/// Name/// </summary>publicstringName{get;set;}/// <summary>/// Owned entity/// </summary>publicOwned?Owned{get;set;}}publicclassOwned{/// <summary>/// Property A/// </summary>publicstring?A{get;set;}/// <summary>/// Property B/// </summary>publicstring?B{get;set;}}
Comparing nullable owned entity to null in Select methods returns incorrect result - the null comparison returns
true
even when the owned entity exists.Steps to reproduce
Having model with
Owner
andOwned
classesWhere
Owner
ownsOwned
The query
Returns data (after serialization to JSON)
Observe that the owned entity is returned, yet the
OwnedIsNull
istrue
.This behavior is independent on database provider, tested with SQLite and MySQL providers.
See attached project for minimal reproduction
EFCoreBug.OwnedEntityNull.zip
Provider and version information
EF Core version: 7.0.8
Database provider: Microsoft.EntityFrameworkCore.Sqlite
Target framework: .NET 7.0
Operating system: Windows 10
IDE: Visual Studio 2022 17.6.4
The text was updated successfully, but these errors were encountered: