mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-08-15 18:44:57 +00:00
Rewrite generated expressions to ignore nullability
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using Foo;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class Foo_C_NextFoo
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<object? ,int?, object>> Expression =>
|
||||
(object? unusedArgument,int? nullablePrimitiveArgument) => null;
|
||||
}
|
||||
}
|
||||
+26
@@ -384,6 +384,32 @@ namespace Foo {
|
||||
Assert.Single(result.Diagnostics);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task NullableReferenceTypesAreBeingEliminated()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using System;
|
||||
using System.Linq;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace Foo {
|
||||
static class C {
|
||||
[Projectable]
|
||||
public static object? NextFoo(this object? unusedArgument, int? nullablePrimitiveArgument) => null;
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
var result = RunGenerator(compilation);
|
||||
|
||||
Assert.Empty(result.Diagnostics);
|
||||
Assert.Single(result.GeneratedTrees);
|
||||
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
Compilation CreateCompilation(string source, bool expectedToCompile = true)
|
||||
|
||||
Reference in New Issue
Block a user