-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: do not emit null coalesce operator in queryable mappings
- Loading branch information
Showing
9 changed files
with
116 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
using System.Diagnostics; | ||
|
||
namespace Riok.Mapperly.Symbols.Members; | ||
|
||
[DebuggerDisplay("{MemberPath} ({Type})")] | ||
public record SourceMemberPath(MemberPath MemberPath, SourceMemberType Type); |
This file contains 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
53 changes: 53 additions & 0 deletions
53
...hots/QueryableProjectionNullableTest.NestedPropertyWithDeepCloneable#Mapper.g.verified.cs
This file contains 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,53 @@ | ||
//HintName: Mapper.g.cs | ||
// <auto-generated /> | ||
#nullable enable | ||
public partial class Mapper | ||
{ | ||
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] | ||
public partial global::System.Linq.IQueryable<global::B?>? Map(global::System.Linq.IQueryable<global::A?>? source) | ||
{ | ||
if (source == null) | ||
return default; | ||
#nullable disable | ||
return System.Linq.Queryable.Select( | ||
source, | ||
x => new global::B() | ||
{ | ||
Value0 = x.Nested != null && x.Nested.Value0 != null ? global::System.Linq.Enumerable.ToArray( | ||
global::System.Linq.Enumerable.Select(x.Nested.Value0, x1 => x1 == null ? default : x1) | ||
) : default, | ||
Value = x.Nested != null && x.Nested.Value != null ? x.Nested.Value : default, | ||
} | ||
); | ||
#nullable enable | ||
} | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] | ||
public partial global::B? MapConfig(global::A? source) | ||
{ | ||
if (source == null) | ||
return default; | ||
var target = new global::B(); | ||
if (source.Nested?.Value0 != null) | ||
{ | ||
target.Value0 = MapToStringArray(source.Nested.Value0); | ||
} | ||
else | ||
{ | ||
target.Value0 = null; | ||
} | ||
target.Value = source.Nested?.Value; | ||
return target; | ||
} | ||
|
||
[global::System.CodeDom.Compiler.GeneratedCode("Riok.Mapperly", "0.0.1.0")] | ||
private string?[] MapToStringArray(string?[] source) | ||
{ | ||
var target = new string?[source.Length]; | ||
for (var i = 0; i < source.Length; i++) | ||
{ | ||
target[i] = source[i] == null ? default : source[i]!; | ||
} | ||
return target; | ||
} | ||
} |
This file contains 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