HandlerServicesDescriptor Class
Definition
Provides information, in a developer friendly way, about implementations of the IHandler<TRequest> interface such as name, declared members and what type of request they handle.
public class HandlerServicesDescriptor : IHandlerServicesDescriptor
- Inheritance
-
HandlerServicesDescriptor
- Implements
Examples
HandlerServicesDescriptor produces a human-readable handler discovery report. Create it with the service groups and types from the DI container or empty collections for diagnostics, then call ToString() to get the formatted report.
using System;
using System.Collections.Generic;
using System.Linq;
using Savvyio;
using Savvyio.Handlers;
namespace ExampleApp;
public sealed class HandlerServicesDescriptorExample
{
public static void PrintReport()
{
var emptyGroups = Enumerable.Empty<IGrouping<Type, KeyValuePair<Type, List<Cuemon.Extensions.Runtime.IHierarchy<object>>>>>();
var descriptor = new HandlerServicesDescriptor(emptyGroups, new[] { typeof(IHandler<IRequest>) });
Console.WriteLine(descriptor.ToString());
}
}
Remarks
An example of the output available when calling ToString():
Discovered 1 ICommandHandler implementation covering a total of 5 ICommand methods
Assembly: Savvyio.Assets.Tests
Namespace: Savvyio.Assets
<AccountCommandHandler>
*UpdateAccount --> &<RegisterDelegates>b__5_0
*CreateAccount --> &CreateAccountAsync
Constructors
| Name | Description |
|---|---|
| HandlerServicesDescriptor(IEnumerable<IGrouping<Type, KeyValuePair<Type, List<IHierarchy<object>>>>>, IEnumerable<Type>) | Initializes a new instance of the HandlerServicesDescriptor class. |
Methods
| Name | Description |
|---|---|
| GenerateHandlerDiscoveries() | Generates the handler discoveries. |
| ToString() | Returns a string that represents this instance. |