mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-04-10 17:59:38 +08:00
26 lines
777 B
C#
26 lines
777 B
C#
using System.Reflection;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace BuildingBlocks.EventStoreDB;
|
|
|
|
using Web;
|
|
|
|
public static class Extensions
|
|
{
|
|
// ref: https://github.com/oskardudycz/EventSourcing.NetCore/tree/main/Sample/EventStoreDB/ECommerce
|
|
public static IServiceCollection AddEventStore(
|
|
this IServiceCollection services,
|
|
IConfiguration configuration,
|
|
params Assembly[] assemblies
|
|
)
|
|
{
|
|
services.AddValidateOptions<EventStoreOptions>();
|
|
|
|
var assembliesToScan = assemblies.Length > 0 ? assemblies : new[] { Assembly.GetEntryAssembly()! };
|
|
|
|
return services
|
|
.AddEventStoreDB(configuration)
|
|
.AddProjections(assembliesToScan);
|
|
}
|
|
} |