It's possible to read an [Attribute] from a "NotificationHandler" in PublishCore method? #794
igorgomeslima
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've the following code structure to decide if a
INotificationHandler.Handle
method needs to run like a "background job":BackgroundExecutionAttribute.cs
public class BackgroundExecutionAttribute : Attribute { }
CustomNotification.cs
public abstract record CustomNotification(string Id) : INotification;
UserCreated.cs
public record UserCreated(string Id) : CustomNotification(Id);
BaseNotificationHandler.cs
SendEmailAferUserCreationNotificationHandler .cs
But I want to do this decision "more close" to the "real method call", to maybe catch exceptions, etc... something like:
That way I don't need to require an instance of
IBackgroundJobClient
for everyone who inherits fromBaseNotificationHandler
, like:To:
Can I get an specific attribute from in this overloaded method(like from
handler
on foreach loop)? It's a good idea?Thanks for any review/help.
Cheers! 🙌
Beta Was this translation helpful? Give feedback.
All reactions