Compare commits
6 Commits
4
.github/workflows/push_main.yml
vendored
4
.github/workflows/push_main.yml
vendored
@@ -4,8 +4,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
#paths:
|
paths:
|
||||||
#- "TimetableDesigner.Backend.Events**"
|
- "TimetableDesigner.Backend.Events**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -2,7 +2,16 @@
|
|||||||
|
|
||||||
namespace TimetableDesigner.Backend.Events;
|
namespace TimetableDesigner.Backend.Events;
|
||||||
|
|
||||||
public abstract class EventQueue
|
public abstract class EventQueue<TSelf> where TSelf : EventQueue<TSelf>
|
||||||
{
|
{
|
||||||
public abstract void Setup(IServiceCollection services);
|
public void Setup<TBuilder>(IServiceCollection services, TBuilder configuration)
|
||||||
|
where TBuilder : EventQueueBuilder<TSelf> =>
|
||||||
|
Setup(services, configuration.GetConnectionParameters());
|
||||||
|
|
||||||
|
public void Setup(IServiceCollection services, string connectionString)
|
||||||
|
=> Setup(services, connectionString.Split(';')
|
||||||
|
.Select(x => x.Split('='))
|
||||||
|
.ToDictionary(x => x.First(), x => x.Last()));
|
||||||
|
|
||||||
|
protected abstract void Setup(IServiceCollection services, IDictionary<string, string> connectionParameters);
|
||||||
}
|
}
|
||||||
|
|||||||
6
TimetableDesigner.Backend.Events/EventQueueBuilder.cs
Normal file
6
TimetableDesigner.Backend.Events/EventQueueBuilder.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace TimetableDesigner.Backend.Events;
|
||||||
|
|
||||||
|
public abstract class EventQueueBuilder<TQueue> where TQueue : EventQueue<TQueue>
|
||||||
|
{
|
||||||
|
public abstract IDictionary<string, string> GetConnectionParameters();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user