mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-29 13:12:01 +00:00
Fully qualify extension method calls
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ namespace EntityFrameworkCore.Projectables.Generated
|
||||
public static System.Linq.Expressions.Expression<System.Func<object, object>> Expression()
|
||||
{
|
||||
return (object i) =>
|
||||
i.Foo1();
|
||||
global::Foo.C.Foo1(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ namespace EntityFrameworkCore.Projectables.Generated
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, global::Foo.D>> Expression()
|
||||
{
|
||||
return (global::Foo.C @this) =>
|
||||
@this.Dees.First();
|
||||
global::System.Linq.Enumerable.First(@this.Dees);
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// <auto-generated/>
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using One.Two;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
|
||||
public static class One_Two_Bar_Method
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::One.Two.Bar, int>> Expression()
|
||||
{
|
||||
return (global::One.Two.Bar @this) =>
|
||||
global::One.IntExtensions.AddOne(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@ namespace EntityFrameworkCore.Projectables.Generated
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
|
||||
{
|
||||
return (global::Foo.C @this) =>
|
||||
@this.Dees.OfType<global::Foo.D>().Count();
|
||||
global::System.Linq.Enumerable.Count(global::System.Linq.Enumerable.OfType<D>(@this.Dees));
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -1514,6 +1514,34 @@ class Foo {
|
||||
return Verifier.Verify(result.GeneratedTrees[0].ToString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public Task RequiredNamespace()
|
||||
{
|
||||
var compilation = CreateCompilation(@"
|
||||
using EntityFrameworkCore.Projectables;
|
||||
|
||||
namespace One {
|
||||
static class IntExtensions {
|
||||
public static int AddOne(this int i) => i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
namespace One.Two {
|
||||
class Bar {
|
||||
[Projectable]
|
||||
public int Method() => 1.AddOne();
|
||||
}
|
||||
}
|
||||
");
|
||||
|
||||
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