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
Uh oh!
There was an error while loading. Please reload this page.
-
I've the following code structure to decide if a
INotificationHandler.Handlemethod 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
IBackgroundJobClientfor everyone who inherits fromBaseNotificationHandler, like:To:
Can I get an specific attribute from in this overloaded method(like from
handleron foreach loop)? It's a good idea?Thanks for any review/help.
Cheers! 🙌
Beta Was this translation helpful? Give feedback.
All reactions