mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-18 17:26:35 +00:00
Added fix for inherited members
This commit is contained in:
@@ -98,7 +98,7 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
{
|
||||
var symbolInfo = _semanticModel.GetSymbolInfo(node);
|
||||
|
||||
if (symbolInfo.Symbol is not null && SymbolEqualityComparer.Default.Equals(symbolInfo.Symbol.ContainingType, _targetTypeSymbol))
|
||||
if (symbolInfo.Symbol is not null)
|
||||
{
|
||||
var scopedNode = node.ChildNodes().FirstOrDefault();
|
||||
if (scopedNode is ThisExpressionSyntax)
|
||||
@@ -127,7 +127,7 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
if (symbolInfo.Symbol is IMethodSymbol methodSymbol && methodSymbol.IsExtensionMethod)
|
||||
{
|
||||
}
|
||||
else if (symbolInfo.Symbol.Kind is SymbolKind.Property or SymbolKind.Method or SymbolKind.Field && SymbolEqualityComparer.Default.Equals(symbolInfo.Symbol.ContainingType, _targetTypeSymbol))
|
||||
else if (symbolInfo.Symbol.Kind is SymbolKind.Property or SymbolKind.Method or SymbolKind.Field /*&& SymbolEqualityComparer.Default.Equals(symbolInfo.Symbol.ContainingType, _targetTypeSymbol)*/)
|
||||
{
|
||||
bool rewrite = true;
|
||||
|
||||
@@ -138,6 +138,10 @@ namespace EntityFrameworkCore.Projectables.Generator
|
||||
{
|
||||
rewrite = false;
|
||||
}
|
||||
if (targetSymbolInfo.Symbol?.ContainingType is not null && !_context.Compilation.HasImplicitConversion(targetSymbolInfo.Symbol.ContainingType, _targetTypeSymbol))
|
||||
{
|
||||
rewrite = false;
|
||||
}
|
||||
}
|
||||
else if (node.Parent.IsKind(SyntaxKind.SimpleAssignmentExpression))
|
||||
{
|
||||
|
||||
-5
@@ -23,11 +23,6 @@
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="**\*.verified.txt" />
|
||||
<None Remove="**\*.received.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables.Generator\EntityFrameworkCore.Projectables.Generator.csproj" />
|
||||
<ProjectReference Include="..\..\src\EntityFrameworkCore.Projectables\EntityFrameworkCore.Projectables.csproj" />
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using EntityFrameworkCore.Projectables;
|
||||
using Foo;
|
||||
|
||||
namespace EntityFrameworkCore.Projectables.Generated
|
||||
#nullable disable
|
||||
{
|
||||
public static class Foo_Bar_ProjectedId
|
||||
{
|
||||
public static System.Linq.Expressions.Expression<System.Func<global::Foo.Bar, int>> Expression()
|
||||
{
|
||||
return (global::Foo.Bar @this) =>
|
||||
Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user