Exemplo n.º 1
0
    public static IEnumerable <MediatorListenerDescription> Create(Type listenerType)
    {
        if (listenerType is null)
        {
            throw new ArgumentNullException(nameof(listenerType));
        }

        if (!CanListenerize(listenerType))
        {
            throw new ArgumentException(SR.Argument_CanNotListenerize(nameof(listenerType)));
        }

        var evListenerAttrs = listenerType.GetAttributes <AsEventListenerAttribute>(true).ToList();
        var paths           = evListenerAttrs.Select(attr => attr.Path);

        return(paths.Select(path =>
                            new MediatorListenerDescription(path, listenerType)
                            ).ToList());
    }