dotnet-cqrs/Svrnty.CQRS/Discovery/QueryDiscovery.cs
Svrnty 5f3602d071 fix: resolve nullability warnings, add CI/CD and security workflows, harden .gitignore
- 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>
2026-02-27 19:28:24 -05:00

24 lines
823 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Svrnty.CQRS.Abstractions.Discovery;
namespace Svrnty.CQRS.Discovery;
public sealed class QueryDiscovery : IQueryDiscovery
{
private readonly IEnumerable<IQueryMeta> _queryMetas;
public QueryDiscovery(IEnumerable<IQueryMeta> queryMetas)
{
_queryMetas = queryMetas;
}
public IEnumerable<IQueryMeta> GetQueries() => _queryMetas;
public IQueryMeta? FindQuery(string name) => _queryMetas.FirstOrDefault(t => t.Name == name);
public IQueryMeta? FindQuery(Type queryType) => _queryMetas.FirstOrDefault(t => t.QueryType == queryType);
public bool QueryExists(string name) => _queryMetas.Any(t => t.Name == name);
public bool QueryExists(Type queryType) => _queryMetas.Any(t => t.QueryType == queryType);
}