-
Notifications
You must be signed in to change notification settings - Fork 934
Enhance nullability check for "==" and "!=" operators for LINQ provider #1996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f477237
Enhance nullability check for "==" and "!=" operators for LINQ provider
maca88 c273c20
Split subselect tests
maca88 40b830d
Moved nullable check code into a separated class
maca88 f5a5acb
Fix edge case scenarios
maca88 c01ac7b
Fix TryGetEntityName for interface mapped members
maca88 f089c44
Fix TryGetEntityName for custom entity names
maca88 a0863a1
Fix some CodeFactor issues
maca88 96e29c2
Regenerate async
maca88 29d2052
Update code to use TryGetMappedNullability method
maca88 9d08170
Adjust some details
fredericDelaporte d250971
Code review changes
maca88 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/NHibernate.DomainModel/Northwind/Entities/AnotherEntityRequired.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace NHibernate.DomainModel.Northwind.Entities | ||
{ | ||
public class AnotherEntityRequired | ||
{ | ||
public virtual int Id { get; set; } | ||
|
||
public virtual string Output { get; set; } | ||
|
||
public virtual string Input { get; set; } | ||
|
||
public virtual Address Address { get; set; } | ||
|
||
public virtual AnotherEntityNullability InputNullability { get; set; } | ||
|
||
public virtual string NullableOutput { get; set; } | ||
|
||
public virtual AnotherEntityRequired NullableAnotherEntityRequired { get; set; } | ||
|
||
public virtual int? NullableAnotherEntityRequiredId { get; set; } | ||
|
||
public virtual ISet<AnotherEntity> RelatedItems { get; set; } = new HashSet<AnotherEntity>(); | ||
|
||
public virtual bool? NullableBool { get; set; } | ||
} | ||
|
||
public enum AnotherEntityNullability | ||
{ | ||
False = 0, | ||
True = 1 | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/NHibernate.DomainModel/Northwind/Mappings/AnotherEntityRequired.hbm.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="NHibernate.DomainModel.Northwind.Entities" assembly="NHibernate.DomainModel"> | ||
<class name="AnotherEntityRequired" table="AnotherEntity" mutable="false" schema-action="none"> | ||
<id name="Id"> | ||
<generator class="native" /> | ||
</id> | ||
<property name="Output" not-null="true" /> | ||
<property name="Input" not-null="true" /> | ||
<property name="NullableOutput" formula="Output" lazy="true" /> | ||
<property name="InputNullability" formula="case when Input is not null then 0 else 1 end" lazy="true" /> | ||
<property name="NullableAnotherEntityRequiredId" formula="Id" lazy="true" /> | ||
<property name="NullableBool" formula="null" lazy="true" /> | ||
<component name="Address" insert="false" update="false" lazy="true"> | ||
<property name="Street" formula="Input" access="field.camelcase-underscore" /> | ||
<property name="City" formula="Output" access="field.camelcase-underscore" /> | ||
</component> | ||
<many-to-one name="NullableAnotherEntityRequired" formula="Id" /> | ||
<set name="RelatedItems" lazy="true" inverse="true"> | ||
<key column="Id"/> | ||
<one-to-many class="AnotherEntity"/> | ||
</set> | ||
</class> | ||
</hibernate-mapping> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,19 @@ | |
<generator class="assigned" /> | ||
</id> | ||
|
||
<property name="Name" type="AnsiString" /> | ||
<property name="Name" type="AnsiString" not-null="true" /> | ||
<property name="InvalidLoginAttempts" type="Int32" /> | ||
<property name="RegisteredAt" type="DateTime" /> | ||
<property name="LastLoginDate" type="DateTime" /> | ||
|
||
<many-to-one name="CreatedBy" class="User" not-null="true" lazy="false"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to add |
||
<column name="CreatedById" not-null="true" /> | ||
</many-to-one> | ||
|
||
<many-to-one name="ModifiedBy" class="User" lazy="false"> | ||
<column name="ModifiedById" /> | ||
</many-to-one> | ||
|
||
<property name="Enum1" type="NHibernate.DomainModel.Northwind.Entities.EnumStoredAsStringType, NHibernate.DomainModel"> | ||
<column name="Enum1" length="12" /> | ||
</property> | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file modified
BIN
+360 Bytes
(100%)
src/NHibernate.Test/DbScripts/MsSql2008DialectLinqReadonlyCreateScript.sql
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+350 Bytes
(100%)
src/NHibernate.Test/DbScripts/PostgreSQL83DialectLinqReadonlyCreateScript.sql
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had to use lazy as otherwise an invalid query is generated due to the missing table alias for the column used in the formula.