Class HandlerServiceAssemblyModel
- Namespace
- Savvyio
- Assembly
- Savvyio.Core.dll
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
HandlerServiceAssemblyModel(Type)
Initializes a new instance of the HandlerServiceAssemblyModel class.
public HandlerServiceAssemblyModel(Type handlerImplementationType)
Parameters
Properties
Implementations
Gets or sets the implementations of the handler service type.
public IEnumerable<HandlerServiceTypeImplementationModel> Implementations { get; }
Property Value
Name
Gets the name of the assembly.
public string Name { get; init; }
Property Value
Namespace
Gets the namespace of the handler implementation.
public string Namespace { get; init; }