Merge pull request #60 from koenbeuk/issue-54

Add support projectable members declared on generic abstract classes
This commit is contained in:
Koen
2023-02-08 02:18:59 +00:00
committed by GitHub
71 changed files with 652 additions and 720 deletions

View File

@@ -28,7 +28,7 @@ namespace EntityFrameworkCore.Projectables.Generator
visitedNode = visitedParameterSyntax.WithModifiers(node.Modifiers.RemoveAt(thisKeywordIndex));
}
// Strip the parans keyword of any parameter
// Strip the params keyword of any parameter
var paramsKeywordIndex = ((ParameterSyntax)visitedNode).Modifiers.IndexOf(SyntaxKind.ParamsKeyword);
if (paramsKeywordIndex != -1)
{
@@ -73,6 +73,19 @@ namespace EntityFrameworkCore.Projectables.Generator
return base.VisitIdentifierName(node);
}
public override SyntaxNode? VisitGenericName(GenericNameSyntax node)
{
var typeInfo = _semanticModel.GetTypeInfo(node);
if (typeInfo.Type is not null)
{
return SyntaxFactory.ParseTypeName(
typeInfo.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
).WithTriviaFrom(node);
}
return base.VisitGenericName(node);
}
public override SyntaxNode? VisitQualifiedName(QualifiedNameSyntax node)
{
var typeInfo = _semanticModel.GetTypeInfo(node);

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IsPackable>false</IsPackable>
</PropertyGroup>

View File

@@ -11,8 +11,6 @@ namespace EntityFrameworkCore.Projectables.Generator
{
public class ProjectableDescriptor
{
public IEnumerable<string>? UsingDirectives { get; set; }
public string? ClassNamespace { get; set; }
public IEnumerable<string>? NestedInClassNames { get; set; }
@@ -23,6 +21,10 @@ namespace EntityFrameworkCore.Projectables.Generator
public string? ClassName { get; set; }
public TypeParameterListSyntax? ClassTypeParameterList { get; set; }
public SyntaxList<TypeParameterConstraintClauseSyntax>? ClassConstraintClauses { get; set; }
public string? MemberName { get; set; }
public string? ReturnTypeName { get; set; }
@@ -31,8 +33,8 @@ namespace EntityFrameworkCore.Projectables.Generator
public TypeParameterListSyntax? TypeParameterList { get; set; }
public IEnumerable<TypeParameterConstraintClauseSyntax>? ConstraintClauses { get; set; }
public SyntaxList<TypeParameterConstraintClauseSyntax>? ConstraintClauses { get; set; }
public SyntaxNode? Body { get; set; }
public ExpressionSyntax? ExpressionBody { get; set; }
}
}

View File

@@ -123,23 +123,52 @@ namespace EntityFrameworkCore.Projectables.Generator
ClassNamespace = memberSymbol.ContainingType.ContainingNamespace.IsGlobalNamespace ? null : memberSymbol.ContainingType.ContainingNamespace.ToDisplayString(),
MemberName = memberSymbol.Name,
NestedInClassNames = GetNestedInClassPath(memberSymbol.ContainingType),
ParametersList = SyntaxFactory.ParameterList(),
TypeParameterList = SyntaxFactory.TypeParameterList()
ParametersList = SyntaxFactory.ParameterList()
};
if (memberSymbol.ContainingType is INamedTypeSymbol { IsGenericType: true } containingNamedType)
{
descriptor.ClassTypeParameterList = SyntaxFactory.TypeParameterList();
foreach (var additionalClassTypeParameter in containingNamedType.TypeParameters)
{
descriptor.ClassTypeParameterList = descriptor.ClassTypeParameterList.AddParameters(
SyntaxFactory.TypeParameter(additionalClassTypeParameter.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat))
);
if (!additionalClassTypeParameter.ConstraintTypes.IsDefaultOrEmpty)
{
descriptor.ClassConstraintClauses ??= SyntaxFactory.List<TypeParameterConstraintClauseSyntax>();
descriptor.ClassConstraintClauses = descriptor.ClassConstraintClauses.Value.Add(
SyntaxFactory.TypeParameterConstraintClause(
SyntaxFactory.IdentifierName(additionalClassTypeParameter.Name),
SyntaxFactory.SeparatedList<TypeParameterConstraintSyntax>(
additionalClassTypeParameter
.ConstraintTypes
.Select(c => SyntaxFactory.TypeConstraint(
SyntaxFactory.IdentifierName(c.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat))
))
)
)
);
}
// todo: add additional type constraints
}
}
if (!member.Modifiers.Any(SyntaxKind.StaticKeyword))
{
descriptor.ParametersList = descriptor.ParametersList.AddParameters(
SyntaxFactory.Parameter(
SyntaxFactory.Identifier("@this")
).WithType(
SyntaxFactory.ParseTypeName(
memberSymbol.ContainingType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
)
.WithTrailingTrivia(
SyntaxFactory.SyntaxTrivia(SyntaxKind.WhitespaceTrivia, " ")
)
SyntaxFactory.Identifier("@this")
)
.WithType(
SyntaxFactory.ParseTypeName(
memberSymbol.ContainingType.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)
)
)
);
}
@@ -169,7 +198,7 @@ namespace EntityFrameworkCore.Projectables.Generator
var returnType = declarationSyntaxRewriter.Visit(methodDeclarationSyntax.ReturnType);
descriptor.ReturnTypeName = returnType.ToString();
descriptor.Body = expressionSyntaxRewriter.Visit(methodDeclarationSyntax.ExpressionBody.Expression);
descriptor.ExpressionBody = (ExpressionSyntax)expressionSyntaxRewriter.Visit(methodDeclarationSyntax.ExpressionBody.Expression);
foreach (var additionalParameter in ((ParameterListSyntax)declarationSyntaxRewriter.Visit(methodDeclarationSyntax.ParameterList)).Parameters)
{
descriptor.ParametersList = descriptor.ParametersList.AddParameters(additionalParameter);
@@ -177,6 +206,7 @@ namespace EntityFrameworkCore.Projectables.Generator
if (methodDeclarationSyntax.TypeParameterList is not null)
{
descriptor.TypeParameterList = SyntaxFactory.TypeParameterList();
foreach (var additionalTypeParameter in ((TypeParameterListSyntax)declarationSyntaxRewriter.Visit(methodDeclarationSyntax.TypeParameterList)).Parameters)
{
descriptor.TypeParameterList = descriptor.TypeParameterList.AddParameters(additionalTypeParameter);
@@ -185,8 +215,11 @@ namespace EntityFrameworkCore.Projectables.Generator
if (methodDeclarationSyntax.ConstraintClauses.Any())
{
descriptor.ConstraintClauses = methodDeclarationSyntax.ConstraintClauses
.Select(x => (TypeParameterConstraintClauseSyntax)declarationSyntaxRewriter.Visit(x));
descriptor.ConstraintClauses = SyntaxFactory.List(
methodDeclarationSyntax
.ConstraintClauses
.Select(x => (TypeParameterConstraintClauseSyntax)declarationSyntaxRewriter.Visit(x))
);
}
}
else if (memberBody is PropertyDeclarationSyntax propertyDeclarationSyntax)
@@ -201,20 +234,13 @@ namespace EntityFrameworkCore.Projectables.Generator
var returnType = declarationSyntaxRewriter.Visit(propertyDeclarationSyntax.Type);
descriptor.ReturnTypeName = returnType.ToString();
descriptor.Body = expressionSyntaxRewriter.Visit(propertyDeclarationSyntax.ExpressionBody.Expression);
descriptor.ExpressionBody = (ExpressionSyntax)expressionSyntaxRewriter.Visit(propertyDeclarationSyntax.ExpressionBody.Expression);
}
else
{
return null;
}
descriptor.UsingDirectives =
member.SyntaxTree
.GetRoot()
.DescendantNodes()
.OfType<UsingDirectiveSyntax>()
.Select(x => x.ToString());
return descriptor;
}
}

View File

@@ -8,9 +8,11 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
namespace EntityFrameworkCore.Projectables.Generator
{
@@ -19,6 +21,22 @@ namespace EntityFrameworkCore.Projectables.Generator
{
private const string ProjectablesAttributeName = "EntityFrameworkCore.Projectables.ProjectableAttribute";
static readonly AttributeSyntax _editorBrowsableAttribute =
Attribute(
ParseName("global::System.ComponentModel.EditorBrowsable"),
AttributeArgumentList(
SingletonSeparatedList(
AttributeArgument(
MemberAccessExpression(
SyntaxKind.SimpleMemberAccessExpression,
IdentifierName("global::System.ComponentModel.EditorBrowsableState"),
IdentifierName("Never")
)
)
)
)
);
public void Initialize(IncrementalGeneratorInitializationContext context)
{
// Do a simple filter for members
@@ -91,76 +109,84 @@ namespace EntityFrameworkCore.Projectables.Generator
throw new InvalidOperationException("Expected a memberName here");
}
resultBuilder.Clear();
resultBuilder.AppendLine("// <auto-generated/>");
if (projectable.UsingDirectives is not null)
{
foreach (var usingDirective in projectable.UsingDirectives.Distinct())
{
resultBuilder.AppendLine(usingDirective);
}
}
if (projectable.TargetClassNamespace is not null)
{
var targetClassUsingDirective = $"using {projectable.TargetClassNamespace};";
if (!projectable.UsingDirectives.Contains(targetClassUsingDirective))
{
resultBuilder.AppendLine(targetClassUsingDirective);
}
}
if (projectable.ClassNamespace is not null && projectable.ClassNamespace != projectable.TargetClassNamespace)
{
var classUsingDirective = $"using {projectable.ClassNamespace};";
if (!projectable.UsingDirectives.Contains(classUsingDirective))
{
resultBuilder.AppendLine(classUsingDirective);
}
}
var generatedClassName = ProjectionExpressionClassNameGenerator.GenerateName(projectable.ClassNamespace, projectable.NestedInClassNames, projectable.MemberName);
var generatedFileName = projectable.ClassTypeParameterList is not null ? $"{generatedClassName}-{projectable.ClassTypeParameterList.ChildNodes().Count()}.g.cs" : $"{generatedClassName}.g.cs";
var lambdaTypeArguments = SyntaxFactory.TypeArgumentList(
SyntaxFactory.SeparatedList(
projectable.ParametersList?.Parameters.Where(p => p.Type is not null).Select(p => p.Type!)
var classSyntax = ClassDeclaration(generatedClassName)
.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword)))
.WithTypeParameterList(projectable.ClassTypeParameterList)
.WithConstraintClauses(projectable.ClassConstraintClauses ?? List<TypeParameterConstraintClauseSyntax>())
.AddAttributeLists(
AttributeList()
.AddAttributes(_editorBrowsableAttribute)
)
);
.AddMembers(
MethodDeclaration(
GenericName(
Identifier("global::System.Linq.Expressions.Expression"),
TypeArgumentList(
SingletonSeparatedList(
(TypeSyntax)GenericName(
Identifier("global::System.Func"),
GetLambdaTypeArgumentListSyntax(projectable)
)
)
)
),
"Expression"
)
.WithModifiers(TokenList(Token(SyntaxKind.StaticKeyword)))
.WithTypeParameterList(projectable.TypeParameterList)
.WithConstraintClauses(projectable.ConstraintClauses ?? List<TypeParameterConstraintClauseSyntax>())
.WithBody(
Block(
ReturnStatement(
ParenthesizedLambdaExpression(
projectable.ParametersList ?? ParameterList(),
null,
projectable.ExpressionBody
)
)
)
)
);
resultBuilder.Append($@"
namespace EntityFrameworkCore.Projectables.Generated
#nullable disable
{{
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class {generatedClassName}
{{
public static System.Linq.Expressions.Expression<System.Func<{(lambdaTypeArguments.Arguments.Any() ? $"{lambdaTypeArguments.Arguments}, " : "")}{projectable.ReturnTypeName}>> Expression{(projectable.TypeParameterList?.Parameters.Any() == true ? projectable.TypeParameterList.ToString() : string.Empty)}()");
if (projectable.ConstraintClauses is not null)
var compilationUnit = CompilationUnit()
.AddMembers(
NamespaceDeclaration(
ParseName("EntityFrameworkCore.Projectables.Generated")
).AddMembers(classSyntax)
)
.WithLeadingTrivia(
TriviaList(
Comment("// <auto-generated/>"),
Trivia(NullableDirectiveTrivia(Token(SyntaxKind.DisableKeyword), true))
)
);
context.AddSource(generatedFileName, SourceText.From(compilationUnit.NormalizeWhitespace().ToFullString(), Encoding.UTF8));
static TypeArgumentListSyntax GetLambdaTypeArgumentListSyntax(ProjectableDescriptor projectable)
{
foreach (var constraintClause in projectable.ConstraintClauses)
var lambdaTypeArguments = TypeArgumentList(
SeparatedList(
// TODO: Document where clause
projectable.ParametersList?.Parameters.Where(p => p.Type is not null).Select(p => p.Type!)
)
);
if (projectable.ReturnTypeName is not null)
{
resultBuilder.Append($@"
{constraintClause}");
lambdaTypeArguments = lambdaTypeArguments.AddArguments(ParseTypeName(projectable.ReturnTypeName));
}
return lambdaTypeArguments;
}
resultBuilder.Append($@"
{{
return {projectable.ParametersList} =>
{projectable.Body};
}}
}}
}}");
context.AddSource($"{generatedClassName}.g.cs", SourceText.From(resultBuilder.ToString(), Encoding.UTF8));
}
}
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

View File

@@ -12,6 +12,19 @@ namespace EntityFrameworkCore.Projectables.Extensions
{
public static class TypeExtensions
{
public static string GetSimplifiedTypeName(this Type type)
{
var name = type.Name;
var backtickIndex = name.IndexOf("`");
if (backtickIndex != -1)
{
name = name.Substring(0, backtickIndex);
}
return name;
}
public static IEnumerable<Type> GetNestedTypePath(this Type type)
{
if (type.IsNested && type.DeclaringType is not null)

View File

@@ -29,16 +29,40 @@ namespace EntityFrameworkCore.Projectables.Services
{
stringBuilder.Append(namespaceName?.Replace('.', '_'));
stringBuilder.Append('_');
var arity = 0;
if (nestedInClassNames is not null)
{
foreach (var className in nestedInClassNames)
{
stringBuilder.Append(className);
var arityCharacterIndex = className.IndexOf('`');
if (arityCharacterIndex is -1)
{
stringBuilder.Append(className);
}
else
{
#if NETSTANDARD2_0
arity += int.Parse(className.Substring(arityCharacterIndex + 1));
#else
arity += int.Parse(className.AsSpan().Slice(arityCharacterIndex + 1));
#endif
stringBuilder.Append(className, 0, arityCharacterIndex);
}
stringBuilder.Append('_');
}
}
stringBuilder.Append(memberName);
if (arity > 0)
{
stringBuilder.Append('`');
stringBuilder.Append(arity);
}
return stringBuilder.ToString();
}
}

View File

@@ -7,6 +7,7 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using EntityFrameworkCore.Projectables.Extensions;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
namespace EntityFrameworkCore.Projectables.Services
{
@@ -14,39 +15,39 @@ namespace EntityFrameworkCore.Projectables.Services
{
public LambdaExpression FindGeneratedExpression(MemberInfo projectableMemberInfo)
{
var declaringType = projectableMemberInfo.DeclaringType ?? throw new InvalidOperationException("Expected a valid type here");
var generatedContainingTypeName = ProjectionExpressionClassNameGenerator.GenerateFullName(declaringType.Namespace, declaringType.GetNestedTypePath().Select(x => x.Name), projectableMemberInfo.Name);
var projectableAttribute = projectableMemberInfo.GetCustomAttribute<ProjectableAttribute>()
?? throw new InvalidOperationException("Expected member to have a Projectable attribute. None found");
var genericArguments = projectableMemberInfo switch {
MethodInfo methodInfo => methodInfo.GetGenericArguments(),
_ => null
};
var expression = GetExpressionFromGeneratedType(projectableMemberInfo);
var expressionFactoryMethod = declaringType.Assembly.GetType(generatedContainingTypeName)
?.GetMethods()
?.FirstOrDefault();
if (expressionFactoryMethod is not null)
if (expression is null && projectableAttribute.UseMemberBody is not null)
{
if (genericArguments is { Length: > 0 })
{
expressionFactoryMethod = expressionFactoryMethod.MakeGenericMethod(genericArguments);
}
return expressionFactoryMethod.Invoke(null, null) as LambdaExpression ?? throw new InvalidOperationException("Expected lambda");
expression = GetExpressionFromMemberBody(projectableMemberInfo, projectableAttribute.UseMemberBody);
}
var useMemberBody = projectableMemberInfo.GetCustomAttribute<ProjectableAttribute>()?.UseMemberBody;
if (useMemberBody is not null)
if (expression is null)
{
var exprProperty = declaringType.GetProperty(useMemberBody, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
var declaringType = projectableMemberInfo.DeclaringType ?? throw new InvalidOperationException("Expected a valid type here");
var fullName = string.Join(".", Enumerable.Empty<string>()
.Concat(new[] { declaringType.Namespace })
.Concat(declaringType.GetNestedTypePath().Select(x => x.Name))
.Concat(new[] { projectableMemberInfo.Name }));
throw new InvalidOperationException($"Unable to resolve generated expression for {fullName}.");
}
return expression;
static LambdaExpression? GetExpressionFromMemberBody(MemberInfo projectableMemberInfo, string memberName)
{
var declaringType = projectableMemberInfo.DeclaringType ?? throw new InvalidOperationException("Expected a valid type here");
var exprProperty = declaringType.GetProperty(memberName, BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
var lambda = exprProperty?.GetValue(null) as LambdaExpression;
if (lambda is not null)
{
if (projectableMemberInfo is PropertyInfo property &&
lambda.Parameters.Count == 1 &&
lambda.Parameters.Count == 1 &&
lambda.Parameters[0].Type == declaringType && lambda.ReturnType == property.PropertyType)
{
return lambda;
@@ -59,18 +60,44 @@ namespace EntityFrameworkCore.Projectables.Services
return lambda;
}
}
return null;
}
var fullName = string.Join(".", Enumerable.Empty<string>()
.Concat(new[] { declaringType.Namespace })
.Concat(declaringType.GetNestedTypePath().Select(x => x.Name))
.Concat(new[] { projectableMemberInfo.Name }));
static LambdaExpression? GetExpressionFromGeneratedType(MemberInfo projectableMemberInfo)
{
var declaringType = projectableMemberInfo.DeclaringType ?? throw new InvalidOperationException("Expected a valid type here");
var generatedContainingTypeName = ProjectionExpressionClassNameGenerator.GenerateFullName(declaringType.Namespace, declaringType.GetNestedTypePath().Select(x => x.Name), projectableMemberInfo.Name);
throw new InvalidOperationException($"Unable to resolve generated expression for {fullName}.") {
Data = {
["GeneratedContainingTypeName"] = generatedContainingTypeName
var expressionFactoryType = declaringType.Assembly.GetType(generatedContainingTypeName);
if (expressionFactoryType is not null)
{
if (expressionFactoryType.IsGenericTypeDefinition)
{
expressionFactoryType = expressionFactoryType.MakeGenericType(declaringType.GenericTypeArguments);
}
var expressionFactoryMethod = expressionFactoryType.GetMethod("Expression", BindingFlags.Static | BindingFlags.NonPublic);
var methodGenericArguments = projectableMemberInfo switch {
MethodInfo methodInfo => methodInfo.GetGenericArguments(),
_ => null
};
if (expressionFactoryMethod is not null)
{
if (methodGenericArguments is { Length: > 0 })
{
expressionFactoryMethod = expressionFactoryMethod.MakeGenericMethod(methodGenericArguments);
}
return expressionFactoryMethod.Invoke(null, null) as LambdaExpression ?? throw new InvalidOperationException("Expected lambda");
}
}
};
return null;
}
}
}
}

View File

@@ -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

View File

@@ -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());
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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};
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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];
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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];
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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];
}
}
}

View File

@@ -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];
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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();
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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));
}
}
}

View File

@@ -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)

View File

@@ -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);