connection string handling added

This commit is contained in:
2026-01-18 18:26:56 +01:00
Unverified
parent b3d2eddfc6
commit def2b9b915
2 changed files with 15 additions and 4 deletions

View File

@@ -4,11 +4,22 @@ namespace TimetableDesigner.Backend.Events.Extensions.AspNetCore.OpenApi;
public static class ServiceCollectionExtensions public static class ServiceCollectionExtensions
{ {
public static IServiceCollection AddEventQueue<T>(this IServiceCollection services, Action<T> configuration) where T : EventQueue, new() public static IServiceCollection AddEventQueue<TQueue, TBuilder>(this IServiceCollection services, Action<TBuilder> configuration)
where TQueue : EventQueue<TQueue>, new()
where TBuilder : EventQueueBuilder<TQueue>, new()
{ {
T builder = new T(); TBuilder builder = new TBuilder();
configuration(builder); configuration(builder);
builder.Setup(services); TQueue queue = new TQueue();
queue.Setup(services, builder);
return services;
}
public static IServiceCollection AddEventQueue<TQueue>(this IServiceCollection services, string connectionString)
where TQueue : EventQueue<TQueue>, new()
{
TQueue queue = new TQueue();
queue.Setup(services, connectionString);
return services; return services;
} }
} }

View File

@@ -13,7 +13,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
<PackageReference Include="timetabledesigner.backend.events" Version="1.1.1" /> <PackageReference Include="timetabledesigner.backend.events" Version="1.1.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>