diff --git a/src/EntityFrameworkCore.Projectables.Generator/ExpressionSyntaxRewriter.cs b/src/EntityFrameworkCore.Projectables.Generator/ExpressionSyntaxRewriter.cs index 0c53cc2..f5215c6 100644 --- a/src/EntityFrameworkCore.Projectables.Generator/ExpressionSyntaxRewriter.cs +++ b/src/EntityFrameworkCore.Projectables.Generator/ExpressionSyntaxRewriter.cs @@ -214,14 +214,9 @@ namespace EntityFrameworkCore.Projectables.Generator // if this node refers to a named type which is not yet fully qualified, we want to fully qualify it if (symbol.Kind is SymbolKind.NamedType && node.Parent?.Kind() is not SyntaxKind.QualifiedName) { - var typeInfo = _semanticModel.GetTypeInfo(node); - - if (typeInfo.Type is not null) - { - return SyntaxFactory.ParseTypeName( - typeInfo.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) - ).WithLeadingTrivia(node.GetLeadingTrivia()); - } + return SyntaxFactory.ParseTypeName( + symbol.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) + ).WithLeadingTrivia(node.GetLeadingTrivia()); } } diff --git a/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.MixPrimaryConstructorAndProperties.verified.txt b/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.MixPrimaryConstructorAndProperties.verified.txt index 170f712..9c6adb3 100644 --- a/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.MixPrimaryConstructorAndProperties.verified.txt +++ b/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.MixPrimaryConstructorAndProperties.verified.txt @@ -7,7 +7,7 @@ namespace EntityFrameworkCore.Projectables.Generated { static global::System.Linq.Expressions.Expression> Expression() { - return (global::Foo.EntityExtensions.Entity entity) => new Entity(entity.Id) + return (global::Foo.EntityExtensions.Entity entity) => new global::Foo.EntityExtensions.Entity(entity.Id) {FullName = entity.FullName}; } } diff --git a/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs b/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs index ea06a89..36981f2 100644 --- a/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs +++ b/tests/EntityFrameworkCore.Projectables.Generator.Tests/ProjectionExpressionGeneratorTests.cs @@ -1615,7 +1615,6 @@ class EntityBase where TId : ICloneable, new() { return Verifier.Verify(result.GeneratedTrees[0].ToString()); } - #region Helpers Compilation CreateCompilation(string source, bool expectedToCompile = true)