dotnet-cqrs/OpenHarbor.CQRS/ServiceCollectionExtensions.cs

22 lines
681 B
C#
Raw Normal View History

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using OpenHarbor.CQRS.Abstractions.Discovery;
using OpenHarbor.CQRS.Discovery;
namespace OpenHarbor.CQRS;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddDefaultQueryDiscovery(this IServiceCollection services)
{
services.TryAddTransient<IQueryDiscovery, QueryDiscovery>();
return services;
}
public static IServiceCollection AddDefaultCommandDiscovery(this IServiceCollection services)
{
services.TryAddTransient<ICommandDiscovery, CommandDiscovery>();
return services;
}
}