IConsumer Events or ActionFilters for extending nopCommerce

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
I am writing a plugin that will capture the events of a customer updating and order completion. From the looks of discussions on the boards, it seems to be a fairly common idea.

After adding a class that inherits from IConsumer<EntityUpdatedEvent<Customer>> it detects some but not all clicks of the Save button on the 'Customer/Info' page.

Is my approach a robust enough capture of the event? or should i be looking into an ActionFilter, which I see a lot of mentions about. I am struggling to understand what is best practice for this type of plugin?

Thanks in advance.
5 years ago
I tend to lead towards ActionFilters, as I can control exactly which Save events I want to hook into. Like if I want it when save happens at backend and not front-end.

However, note that ActionFilters has got some (rather drastic) changes in .NetCore. :)


5 years ago
Thanks. This makes a lot of sense. Especially if there are entity update events that are not relevant.

Can a plugin listen in on the MVC invocation pipeline of the Nop.Web project?
5 years ago
wooncherk wrote:
I tend to lead towards ActionFilters, as I can control exactly which Save events I want to hook into. Like if I want it when save happens at backend and not front-end.

However, note that ActionFilters has got some (rather drastic) changes in .NetCore. :)




Has anyone done this in 4.10? I have created an ActionFilterAttribute and implmentation but I do not know how to trigger the code from a plugin. Can anyone provide some insight?

I still feel that using the Event would be a cleaner approach, just not convinced on its reliability.
5 years ago
Eyre wrote:
I tend to lead towards ActionFilters, as I can control exactly which Save events I want to hook into. Like if I want it when save happens at backend and not front-end.

However, note that ActionFilters has got some (rather drastic) changes in .NetCore. :)




Has anyone done this in 4.10? I have created an ActionFilterAttribute and implmentation but I do not know how to trigger the code from a plugin. Can anyone provide some insight?

I still feel that using the Event would be a cleaner approach, just not convinced on its reliability.

Maybe this link help your problem.
https://www.nopcommerce.com/boards/t/50752/nop-4-payment-plugin_how-to-access-paymentsetting-value-from-a-component.aspx
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.