mirror of
https://github.com/zoriya/EntityFrameworkCore.Projectables.git
synced 2026-05-26 04:09:15 +00:00
Removed unused code
This commit is contained in:
@@ -19,9 +19,6 @@ namespace EntityFrameworkCore.Projectables.Generator
|
|||||||
{
|
{
|
||||||
private const string ProjectablesAttributeName = "EntityFrameworkCore.Projectables.ProjectableAttribute";
|
private const string ProjectablesAttributeName = "EntityFrameworkCore.Projectables.ProjectableAttribute";
|
||||||
|
|
||||||
public void Initialize(GeneratorInitializationContext context) =>
|
|
||||||
context.RegisterForSyntaxNotifications(() => new SyntaxReceiver());
|
|
||||||
|
|
||||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||||
{
|
{
|
||||||
// Do a simple filter for members
|
// Do a simple filter for members
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
using Microsoft.CodeAnalysis;
|
|
||||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EntityFrameworkCore.Projectables.Generator
|
|
||||||
{
|
|
||||||
public class SyntaxReceiver : ISyntaxReceiver
|
|
||||||
{
|
|
||||||
public List<MemberDeclarationSyntax>? Candidates { get; private set; }
|
|
||||||
|
|
||||||
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
|
||||||
{
|
|
||||||
if (syntaxNode is MemberDeclarationSyntax memberDeclarationSyntax && memberDeclarationSyntax.AttributeLists.Count > 0)
|
|
||||||
{
|
|
||||||
var hasProjectableAttribute = memberDeclarationSyntax.AttributeLists
|
|
||||||
.SelectMany(x => x.Attributes)
|
|
||||||
.Any(x => x.Name.ToString().Contains("Projectable"));
|
|
||||||
|
|
||||||
if (hasProjectableAttribute)
|
|
||||||
{
|
|
||||||
if (Candidates == null)
|
|
||||||
{
|
|
||||||
Candidates = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
Candidates.Add(memberDeclarationSyntax);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user