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