mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-24 03:35:38 +00:00
Generator perf improvement
This commit is contained in:
@@ -22,7 +22,7 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (receiver.Candidates.Count > 0)
|
if (receiver.Candidates?.Count > 0)
|
||||||
{
|
{
|
||||||
var projectables = receiver.Candidates
|
var projectables = receiver.Candidates
|
||||||
.Select(x => ProjectableInterpreter.GetDescriptor(x, context))
|
.Select(x => ProjectableInterpreter.GetDescriptor(x, context))
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
{
|
{
|
||||||
public class SyntaxReceiver : ISyntaxReceiver
|
public class SyntaxReceiver : ISyntaxReceiver
|
||||||
{
|
{
|
||||||
public List<MemberDeclarationSyntax> Candidates { get; } = new List<MemberDeclarationSyntax>();
|
public List<MemberDeclarationSyntax>? Candidates { get; private set; }
|
||||||
|
|
||||||
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
||||||
{
|
{
|
||||||
@@ -22,6 +22,11 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
|
|
||||||
if (hasProjectableAttribute)
|
if (hasProjectableAttribute)
|
||||||
{
|
{
|
||||||
|
if (Candidates == null)
|
||||||
|
{
|
||||||
|
Candidates = new();
|
||||||
|
}
|
||||||
|
|
||||||
Candidates.Add(memberDeclarationSyntax);
|
Candidates.Add(memberDeclarationSyntax);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user