1
0
mirror of https://github.com/bitwarden/server synced 2026-01-03 17:14:00 +00:00

Refactor to CQRS

This commit is contained in:
Hinton
2025-12-19 15:15:31 +01:00
parent d9ddd34fbd
commit 44b107d4eb
18 changed files with 341 additions and 267 deletions

View File

@@ -1,11 +1,32 @@
using System.Reflection;
using Bit.Seeder;
using Bit.SeederApi.Commands;
using Bit.SeederApi.Commands.Interfaces;
using Bit.SeederApi.Execution;
using Bit.SeederApi.Queries;
using Bit.SeederApi.Queries.Interfaces;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Bit.SeederApi.Extensions;
public static class ServiceCollectionExtensions
{
/// <summary>
/// Registers SeederApi executors, commands, and queries.
/// </summary>
public static IServiceCollection AddSeederApiServices(this IServiceCollection services)
{
services.AddScoped<ISceneExecutor, SceneExecutor>();
services.AddScoped<IQueryExecutor, QueryExecutor>();
services.AddScoped<IDestroySceneCommand, DestroySceneCommand>();
services.AddScoped<IDestroyBatchScenesCommand, DestroyBatchScenesCommand>();
services.AddScoped<IGetAllPlayIdsQuery, GetAllPlayIdsQuery>();
return services;
}
/// <summary>
/// Dynamically registers all scene types that implement IScene&lt;TRequest&gt; from the Seeder assembly.
/// Scenes are registered as keyed scoped services using their class name as the key.