HandlerServiceAssemblyModel Class
Definition
Represents a model for handler service assemblies.
public record HandlerServiceAssemblyModel : IEquatable<HandlerServiceAssemblyModel>
- Inheritance
-
HandlerServiceAssemblyModel
- Implements
Examples
HandlerServiceAssemblyModel exposes the assembly name and namespace of a discovered handler implementation, populated during the handler discovery phase at startup. Create one by passing the handler implementation type to the constructor. The example creates a model from a concrete handler type and prints the assembly name and namespace.
using System;
using Savvyio;
using Savvyio.Commands;
using Savvyio.Handlers;
namespace ExampleApp;
public sealed class HandlerServiceAssemblyModelExample
{
public void Describe()
{
var model = new HandlerServiceAssemblyModel(typeof(CreateOrderHandler));
Console.WriteLine($"Assembly: {model.Name}, Namespace: {model.Namespace}");
}
}
public sealed class CreateOrderHandler : ICommandHandler
{
public IFireForgetActivator<ICommand> Delegates =>
HandlerFactory.CreateFireForget<ICommand>(r => r.Register<CreateOrderCommand>(_ => { }));
}
public sealed record CreateOrderCommand(string OrderId) : Request, ICommand;
Constructors
| Name | Description |
|---|---|
| HandlerServiceAssemblyModel(Type) | Initializes a new instance of the HandlerServiceAssemblyModel class. |
Properties
| Name | Description |
|---|---|
| Implementations | Gets or sets the implementations of the handler service type. |
| Name | Gets the name of the assembly. |
| Namespace | Gets the namespace of the handler implementation. |