Interlink.Analyzers
1.6.0
Prefix Reserved
dotnet add package Interlink.Analyzers --version 1.6.0
NuGet\Install-Package Interlink.Analyzers -Version 1.6.0
<PackageReference Include="Interlink.Analyzers" Version="1.6.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Interlink.Analyzers" Version="1.6.0" />
<PackageReference Include="Interlink.Analyzers"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Interlink.Analyzers --version 1.6.0
#r "nuget: Interlink.Analyzers, 1.6.0"
#:package Interlink.Analyzers@1.6.0
#addin nuget:?package=Interlink.Analyzers&version=1.6.0
#tool nuget:?package=Interlink.Analyzers&version=1.6.0
Interlink.Analyzers
Roslyn analyzer for the Interlink mediator library.
Installation
dotnet add package Interlink.Analyzers
This is a development dependency (analyzer only). It does not add any runtime assemblies.
What it detects
ILINK001 – Missing request handler
ILINK002 – Duplicate request handler (more than one handler for the same request type)
Raised when a type implements IRequest<TResponse> but no corresponding
IRequestHandler<TRequest, TResponse> is found in the compilation.
Example of ILINK001 - No Handler
// Warning ILINK001: No handler found for request type 'GetAllPets.Query'
public sealed record GetAllPetsQuery : IRequest<List<string>>;
Add a handler to clear the diagnostic:
public sealed class GetAllPetsHandler : IRequestHandler<GetAllPetsQuery, List<string>>
{
public Task<List<string>> Handle(GetAllPetsQuery request, CancellationToken cancellationToken)
=> Task.FromResult(new List<string>());
}
Example of ILINK002 - Duplicate Handler
// Warning ILINK002: Multiple handlers found for request type 'GetSomthing'
public record GetSomthing : IRequest;
public class Handler1 : IRequestHandler<GetSomthing>
{
public Task<Unit> Handle(GetSomthing request, CancellationToken cancellationToken)
=> Unit.Task;
}
public class Handler2 : IRequestHandler<GetSomthing> // duplicate
{
public Task<Unit> Handle(GetSomthing request, CancellationToken cancellationToken)
=> Unit.Task;
}
Remove one of the handlers to clear the diagnostic.
License
MIT © ManuHub
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.