1c81288895
refactor the name of the organisation
24 lines
829 B
C#
24 lines
829 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using OpenHarbor.CQRS.Abstractions.Discovery;
|
|
|
|
namespace OpenHarbor.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);
|
|
}
|
|
|