- Add nullable annotations across discovery interfaces, dynamic query models, and filter/aggregate types to eliminate CS8600-series warnings - Replace unsafe cast in DynamicQueryHandlerBase with pattern match - Add CI workflow (build --warnaserror + test on JP branch) - Add weekly security vulnerability scan workflow - Extend .gitignore with secret/credential patterns (.env, *.key, secrets/, credentials.json) Co-Authored-By: Svrnty Inc. <eng@svrnty.com>
23 lines
877 B
C#
23 lines
877 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Svrnty.CQRS.Abstractions.Discovery;
|
|
|
|
namespace Svrnty.CQRS.Discovery;
|
|
|
|
public sealed class CommandDiscovery : ICommandDiscovery
|
|
{
|
|
private readonly IEnumerable<ICommandMeta> _commandMetas;
|
|
|
|
public CommandDiscovery(IEnumerable<ICommandMeta> commandMetas)
|
|
{
|
|
_commandMetas = commandMetas;
|
|
}
|
|
|
|
public IEnumerable<ICommandMeta> GetCommands() => _commandMetas;
|
|
public ICommandMeta? FindCommand(string name) => _commandMetas.FirstOrDefault(t => t.Name == name);
|
|
public ICommandMeta? FindCommand(Type commandType) => _commandMetas.FirstOrDefault(t => t.CommandType == commandType);
|
|
public bool CommandExists(string name) => _commandMetas.Any(t => t.Name == name);
|
|
public bool CommandExists(Type commandType) => _commandMetas.Any(t => t.CommandType == commandType);
|
|
}
|