Open ardalis opened 1 year ago
Hi @ardalis, thanks for the comment. Yes that would absolutely make sense. Would you be able to contribute and open PR?
Perhaps but I'm not sure if or when I'll find time for it.
Perhaps I'm missing something, but this looks like it's already supported (and has been since 2021). AddMediatRAttributeBehaviors()
has an overload that accepts an IEnumerable of assemblies: https://github.com/ITIXO/MediatR.Extensions.AttributedBehaviors/blob/main/src/MediatR.Extensions.AttributedBehaviors/ServiceCollectionExtensions.cs#L15
We're trying to apply attribute-based behaviors to IRequest types that are defined in a Shared project. However, the call to wire up AttributedBehaviors only accepts a single assembly. After trying to figure out why our behaviors weren't working, we tried moving our IRequest type to the web project and suddenly it started working. I'm assuming this is because we have this in our code:
MediatR accepts a collection of assemblies to scan; can we follow the same pattern for this project, so that we could pass in the executing assembly as well as the shared project's assembly?
Thanks!