Support for declaring projectables on generic classes

This commit is contained in:
Koen
2023-02-08 01:58:28 +00:00
parent 1771c41f28
commit b4da49fc6f
71 changed files with 647 additions and 717 deletions
@@ -0,0 +1,5 @@
DECLARE @__key_0 nvarchar(4000) = N'x';
SELECT [c].[Id]
FROM [ConcreteEntity] AS [c]
WHERE CONVERT(varchar(11), [c].[Id]) = @__key_0
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projectables.FunctionalTests.Helpers;
using Microsoft.EntityFrameworkCore;
using VerifyXunit;
using Xunit;
namespace EntityFrameworkCore.Projectables.FunctionalTests.Generics
{
[UsesVerify]
public class GenericEntityTests
{
public abstract class BaseEntity<TSelf, TKey>
where TSelf : BaseEntity<TSelf, TKey>
{
public TKey Id { get; set; } = default!;
[Projectable(NullConditionalRewriteSupport = NullConditionalRewriteSupport.Ignore)]
public bool HasMatchingStringKeyConversion(string key)
=> Id?.ToString() == key;
}
public class ConcreteEntity : BaseEntity<ConcreteEntity, int>
{
}
[Fact]
public Task HasMatchingStringKeyConversion_GetsTranslated()
{
using var context = new SampleDbContext<ConcreteEntity>();
var key = "x";
var query = context.Set<ConcreteEntity>()
.Where(x => x.HasMatchingStringKeyConversion(key))
.Select(x => x.Id);
return Verifier.Verify(query.ToQueryString());
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
0;
return (global::Foo.C @this) => 0;
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_Derived_Bar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_Derived_Bar
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.Derived, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.Derived, string>> Expression()
{
return (global::Projectables.Repro.Derived @this) =>
@this.Foo;
return (global::Projectables.Repro.Derived @this) => @this.Foo;
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_Derived_Bar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_Derived_Bar
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.Derived, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.Derived, string>> Expression()
{
return (global::Projectables.Repro.Derived @this) =>
@this.Foo;
return (global::Projectables.Repro.Derived @this) => @this.Foo;
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_Derived_Bar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_Derived_Bar
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.Derived, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.Derived, string>> Expression()
{
return (global::Projectables.Repro.Derived @this) =>
@this.Foo();
return (global::Projectables.Repro.Derived @this) => @this.Foo();
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_Derived_Bar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_Derived_Bar
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.Derived, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.Derived, string>> Expression()
{
return (global::Projectables.Repro.Derived @this) =>
@this.Foo();
return (global::Projectables.Repro.Derived @this) => @this.Foo();
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_SomeExtensions_AsSomeResult
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_SomeExtensions_AsSomeResult
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.SomeEntity, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.SomeEntity, string>> Expression()
{
return (global::Projectables.Repro.SomeEntity e) =>
((global::Projectables.Repro.SuperEntity)e).Superpower;
return (global::Projectables.Repro.SomeEntity e) => ((global::Projectables.Repro.SuperEntity)e).Superpower;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Foo_IdWithBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Foo_IdWithBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Foo, int>> Expression()
{
return (global::Foo.Foo @this) =>
@this.Id + global::Foo.Foo.Bar;
return (global::Foo.Foo @this) => @this.Id + global::Foo.Foo.Bar;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Foo_IdWithBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Foo_IdWithBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Foo, int>> Expression()
{
return (global::Foo.Foo @this) =>
@this.Id + global::Foo.Constants.Bar;
return (global::Foo.Foo @this) => @this.Id + global::Foo.Constants.Bar;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Foo_IdWithBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Foo_IdWithBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Foo, int>> Expression()
{
return (global::Foo.Foo @this) =>
@this.Id + global::Foo.Foo.Bar;
return (global::Foo.Foo @this) => @this.Id + global::Foo.Foo.Bar;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_Entity_Something
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_Entity_Something
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
{
return (global::Foo.EntityExtensions.Entity entity) =>
entity;
return (global::Foo.EntityExtensions.Entity entity) => entity;
}
}
}
@@ -1,16 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_Calculate
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _Foo_Calculate
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo ,int, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo, int, int>> Expression()
{
return (global::Foo @this,int i ) =>
i;
return (global::Foo @this, int i) => i;
}
}
}
@@ -1,16 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _SomeExtensions_Test
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _SomeExtensions_Test
{
public static System.Linq.Expressions.Expression<System.Func<global::SomeFlag, bool>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::SomeFlag, bool>> Expression()
{
return (global::SomeFlag f) =>
f == global::SomeFlag.Foo;
return (global::SomeFlag f) => f == global::SomeFlag.Foo;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using System.Collections.Generic;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_SomeEntity_FooOrBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_SomeEntity_FooOrBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.SomeEntity, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.SomeEntity, string>> Expression()
{
return (global::Projectables.Repro.SomeEntity @this) =>
@this.Foo != null ? @this.Foo : @this.Bar;
return (global::Projectables.Repro.SomeEntity @this) => @this.Foo != null ? @this.Foo : @this.Bar;
}
}
}
@@ -1,21 +1,14 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_EnforceString
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_EnforceString
{
public static System.Linq.Expressions.Expression<System.Func<T, string>> Expression<T>()
static global::System.Linq.Expressions.Expression<global::System.Func<T, string>> Expression<T>()
where T : unmanaged
{
return (T value) =>
value.ToString();
return (T value) => value.ToString();
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Collections.Generic;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_NextFoo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_NextFoo
{
public static System.Linq.Expressions.Expression<System.Func<List<object> ,List<int?>, List<object>>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::System.Collections.Generic.List<object>, global::System.Collections.Generic.List<int?>, global::System.Collections.Generic.List<object>>> Expression()
{
return (List<object> input,List<int?> nullablePrimitiveArgument) =>
input;
return (global::System.Collections.Generic.List<object> input, global::System.Collections.Generic.List<int?> nullablePrimitiveArgument) => input;
}
}
}
@@ -0,0 +1,13 @@
// <auto-generated/>
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _EntiyBase_GetId<TId>
{
static global::System.Linq.Expressions.Expression<global::System.Func<TId>> Expression()
{
return () => default;
}
}
}
@@ -0,0 +1,14 @@
// <auto-generated/>
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _EntityBase_GetId<TId>
where TId : global::System.ICloneable
{
static global::System.Linq.Expressions.Expression<global::System.Func<TId>> Expression()
{
return () => default;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Bar_ProjectedId
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Bar_ProjectedId
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Bar, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Bar, int>> Expression()
{
return (global::Foo.Bar @this) =>
@this.Id;
return (global::Foo.Bar @this) => @this.Id;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_A_IsB
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_A_IsB
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.A, bool>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.A, bool>> Expression()
{
return (global::Foo.A @this) =>
@this is global::Foo.B;
return (global::Foo.A @this) => @this is global::Foo.B;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
@this.Bar;
return (global::Foo.C @this) => @this.Bar;
}
}
}
@@ -1,22 +1,14 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_Entity_Something
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_Entity_Something
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
{
return (global::Foo.EntityExtensions.Entity entity) =>
new Entity(entity.Id) {
FullName = entity.FullName
};
return (global::Foo.EntityExtensions.Entity entity) => new Entity(entity.Id)
{FullName = entity.FullName};
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
@this.Bar + @this.Bar + @this.Bar;
return (global::Foo.C @this) => @this.Bar + @this.Bar + @this.Bar;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using System.Collections.Generic;
using Projectables.Repro;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Projectables_Repro_SomeEntity_RootChildren
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Projectables_Repro_SomeEntity_RootChildren
{
public static System.Linq.Expressions.Expression<System.Func<global::Projectables.Repro.SomeEntity, ICollection<global::Projectables.Repro.SomeEntity>>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Projectables.Repro.SomeEntity, global::System.Collections.Generic.ICollection<global::Projectables.Repro.SomeEntity>>> Expression()
{
return (global::Projectables.Repro.SomeEntity @this) =>
@this.Parent != null ? @this.Parent.RootChildren : @this.Children;
return (global::Projectables.Repro.SomeEntity @this) => @this.Parent != null ? @this.Parent.RootChildren : @this.Children;
}
}
}
@@ -1,16 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_SomeNumber
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _Foo_SomeNumber
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo, int>> Expression()
{
return (global::Foo fancyClass) =>
fancyClass != null ? (fancyClass.FancyNumber ) : (int?)null ?? 3;
return (global::Foo fancyClass) => fancyClass != null ? (fancyClass.FancyNumber) : ( int ? )null ?? 3;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_GetFirstRelatedIgnoreNulls
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_GetFirstRelatedIgnoreNulls
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
{
return (global::Foo.EntityExtensions.Entity entity) =>
entity.RelatedEntities[0];
return (global::Foo.EntityExtensions.Entity entity) => entity.RelatedEntities[0];
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_GetFirstRelatedIgnoreNulls
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_GetFirstRelatedIgnoreNulls
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, global::Foo.EntityExtensions.Entity>> Expression()
{
return (global::Foo.EntityExtensions.Entity entity) =>
entity != null ? (entity.RelatedEntities != null ? (entity.RelatedEntities[0]) : (global::Foo.EntityExtensions.Entity)null) : (global::Foo.EntityExtensions.Entity)null;
return (global::Foo.EntityExtensions.Entity entity) => entity != null ? (entity.RelatedEntities != null ? (entity.RelatedEntities[0]) : (global::Foo.EntityExtensions.Entity)null) : (global::Foo.EntityExtensions.Entity)null;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetFirst
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetFirst
{
public static System.Linq.Expressions.Expression<System.Func<string, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, string>> Expression()
{
return (string input) =>
input[0].ToString();
return (string input) => input[0].ToString();
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetFirst
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetFirst
{
public static System.Linq.Expressions.Expression<System.Func<string, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, string>> Expression()
{
return (string input) =>
input != null ? (input[0].ToString()) : (string)null;
return (string input) => input != null ? (input[0].ToString()) : ( string )null;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetLength
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetLength
{
public static System.Linq.Expressions.Expression<System.Func<string, int?>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, int?>> Expression()
{
return (string input) =>
input.Length;
return (string input) => input.Length;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetLength
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetLength
{
public static System.Linq.Expressions.Expression<System.Func<string, int?>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, int?>> Expression()
{
return (string input) =>
input != null ? (input.Length) : (int?)null;
return (string input) => input != null ? (input.Length) : ( int ? )null;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_EntityExtensions_GetFirstName
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_EntityExtensions_GetFirstName
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.EntityExtensions.Entity, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.EntityExtensions.Entity, string>> Expression()
{
return (global::Foo.EntityExtensions.Entity entity) =>
entity.FullName != null ? (entity.FullName.Substring(entity.FullName != null ? (entity.FullName.IndexOf(' ') ) : (int?)null ?? 0)) : (string)null;
return (global::Foo.EntityExtensions.Entity entity) => entity.FullName != null ? (entity.FullName.Substring(entity.FullName != null ? (entity.FullName.IndexOf(' ')) : ( int ? )null ?? 0)) : ( string )null;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Collections.Generic;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_NullableReferenceType
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_NullableReferenceType
{
public static System.Linq.Expressions.Expression<System.Func<object, string>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<object, string>> Expression()
{
return (object input) =>
(string)input;
return (object input) => (string)input;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_NextFoo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_NextFoo
{
public static System.Linq.Expressions.Expression<System.Func<object ,int?, object>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<object, int?, object>> Expression()
{
return (object unusedArgument,int? nullablePrimitiveArgument) =>
null;
return (object unusedArgument, int? nullablePrimitiveArgument) => null;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetFirst
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetFirst
{
public static System.Linq.Expressions.Expression<System.Func<string, char?>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, char?>> Expression()
{
return (string input) =>
input[0];
return (string input) => input[0];
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_GetFirst
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_GetFirst
{
public static System.Linq.Expressions.Expression<System.Func<string, char?>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<string, char?>> Expression()
{
return (string input) =>
input != null ? (input[0]) : (char?)null;
return (string input) => input != null ? (input[0]) : ( char ? )null;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Collections.Generic;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_NullableValueType
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_NullableValueType
{
public static System.Linq.Expressions.Expression<System.Func<object, int?>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<object, int?>> Expression()
{
return (object input) =>
(int?)input;
return (object input) => (int? )input;
}
}
}
@@ -1,16 +0,0 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_First
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo ,int[], int>> Expression()
{
return (global::Foo @this, int[] numbers) =>
numbers[0];
}
}
}
@@ -1,16 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_First
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _Foo_First
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo ,int[], int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo, int[], int>> Expression()
{
return (global::Foo @this,int[] all) =>
all[0];
return (global::Foo @this, int[] all) => all[0];
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C ,int ,string ,object, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int, string, object, int>> Expression()
{
return (global::Foo.C @this,int a,string b,object d) =>
a;
return (global::Foo.C @this, int a, string b, object d) => a;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C ,int, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int, int>> Expression()
{
return (global::Foo.C @this,int i) =>
i;
return (global::Foo.C @this, int i) => i;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
@this.Bar();
return (global::Foo.C @this) => @this.Bar();
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
@this.Bar;
return (global::Foo.C @this) => @this.Bar;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.D, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.D, int>> Expression()
{
return (global::Foo.D d) =>
1;
return (global::Foo.D d) => 1;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<int, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<int, int>> Expression()
{
return (int i) =>
i;
return (int i) => i;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo1
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo1
{
public static System.Linq.Expressions.Expression<System.Func<int, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<int, int>> Expression()
{
return (int i) =>
i;
return (int i) => i;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo1
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo1
{
public static System.Linq.Expressions.Expression<System.Func<object, object>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<object, object>> Expression()
{
return (object i) =>
global::Foo.C.Foo1(i);
return (object i) => global::Foo.C.Foo1(i);
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, global::Foo.D>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, global::Foo.D>> Expression()
{
return (global::Foo.C @this) =>
global::System.Linq.Enumerable.First(@this.Dees);
return (global::Foo.C @this) => global::System.Linq.Enumerable.First(@this.Dees);
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foos;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foos_Bar_FooId
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foos_Bar_FooId
{
public static System.Linq.Expressions.Expression<System.Func<global::Foos.Bar, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foos.Bar, int>> Expression()
{
return (global::Foos.Bar @this) =>
@this.Foo.Id;
return (global::Foos.Bar @this) => @this.Foo.Id;
}
}
}
@@ -1,17 +1,13 @@
// <auto-generated/>
using EntityFrameworkCore.Projectables;
using One.Two;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class One_Two_Bar_Method
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class One_Two_Bar_Method
{
public static System.Linq.Expressions.Expression<System.Func<global::One.Two.Bar, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::One.Two.Bar, int>> Expression()
{
return (global::One.Two.Bar @this) =>
global::One.IntExtensions.AddOne(1);
return (global::One.Two.Bar @this) => global::One.IntExtensions.AddOne(1);
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_D_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_D_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C.D, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C.D, int>> Expression()
{
return (global::Foo.C.D @this) =>
@this.Bar + 1;
return (global::Foo.C.D @this) => @this.Bar + 1;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
@this.Bar + 1;
return (global::Foo.C @this) => @this.Bar + 1;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
1;
return (global::Foo.C @this) => 1;
}
}
}
@@ -1,18 +1,13 @@
// <auto-generated/>
using System;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
1;
return (global::Foo.C @this) => 1;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Foo_IdWithBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Foo_IdWithBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Foo, int>> Expression()
{
return (global::Foo.Foo @this) =>
@this.Id + global::Foo.Foo.Bar;
return (global::Foo.Foo @this) => @this.Id + global::Foo.Foo.Bar;
}
}
}
@@ -1,20 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_Foo_IdWithBar
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_Foo_IdWithBar
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Foo, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.Foo, int>> Expression()
{
return (global::Foo.Foo @this) =>
@this.Id + global::Foo.Constants.Bar;
return (global::Foo.Foo @this) => @this.Id + global::Foo.Constants.Bar;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_Zero
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _Foo_Zero
{
public static System.Linq.Expressions.Expression<System.Func<int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<int>> Expression()
{
return () =>
0;
return () => 0;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using System.Collections.Generic;
using EntityFrameworkCore.Projectables;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class _Foo_Zero
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class _Foo_Zero
{
public static System.Linq.Expressions.Expression<System.Func<int, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<int, int>> Expression()
{
return (int x) =>
0;
return (int x) => 0;
}
}
}
@@ -1,19 +1,13 @@
// <auto-generated/>
using System;
using System.Linq;
using EntityFrameworkCore.Projectables;
using Foo;
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
namespace EntityFrameworkCore.Projectables.Generated
{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class Foo_C_Foo
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
static class Foo_C_Foo
{
public static System.Linq.Expressions.Expression<System.Func<global::Foo.C, int>> Expression()
static global::System.Linq.Expressions.Expression<global::System.Func<global::Foo.C, int>> Expression()
{
return (global::Foo.C @this) =>
global::System.Linq.Enumerable.Count(global::System.Linq.Enumerable.OfType<D>(@this.Dees));
return (global::Foo.C @this) => global::System.Linq.Enumerable.Count(global::System.Linq.Enumerable.OfType<D>(@this.Dees));
}
}
}
@@ -1,5 +1,8 @@
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -537,6 +540,7 @@ namespace Foo {
return Verifier.Verify(result.GeneratedTrees[0].ToString());
}
[Fact]
public Task GenericNullableReferenceTypesAreBeingEliminated()
{
@@ -1566,6 +1570,52 @@ class Foo {
return Verifier.Verify(result.GeneratedTrees[0].ToString());
}
[Fact]
public Task GenericTypes()
{
// issue: https://github.com/koenbeuk/EntityFrameworkCore.Projectables/issues/48
var compilation = CreateCompilation(@"
using EntityFrameworkCore.Projectables;
class EntiyBase<TId> {
[Projectable]
public static TId GetId() => default;
}
");
var result = RunGenerator(compilation);
Assert.Empty(result.Diagnostics);
Assert.Single(result.GeneratedTrees);
return Verifier.Verify(result.GeneratedTrees[0].ToString());
}
[Fact]
public Task GenericTypesWithConstraints()
{
// issue: https://github.com/koenbeuk/EntityFrameworkCore.Projectables/issues/48
var compilation = CreateCompilation(@"
using System;
using EntityFrameworkCore.Projectables;
class EntityBase<TId> where TId : ICloneable, new() {
[Projectable]
public static TId GetId() => default;
}
");
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)
@@ -14,6 +14,8 @@ namespace EntityFrameworkCore.Projectables.Tests.Services
[InlineData("ns", new string[] { "a" }, "m", "ns_a_m")]
[InlineData("ns", new string[] { "a", "b" }, "m", "ns_a_b_m")]
[InlineData(null, new string[] { "a" }, "m", "_a_m")]
[InlineData("ns", new string[] { "a`1" }, "m", "ns_a_m`1" )]
[InlineData("ns", new string[] { "a`1", "b`1" }, "m", "ns_a_b_m`2")]
public void GenerateName(string? namespaceName, string[] nestedTypeNames, string memberName, string expected)
{
var result = ProjectionExpressionClassNameGenerator.GenerateName(namespaceName, nestedTypeNames, memberName);