Other

Day 21: Business Logic Customization and the Four Plugin Stages

DEV Community: #dotnet Jeff Tsai
Other

A .NET ERP framework opens four lighter plugin hooks — BeforeSave, AfterSave, BeforeDelete, AfterDelete — instead of forcing you to subclass a whole business object. The post explains what each stage suits, how failures propagate and where outbound sync really belongs.

Key points

  • Four stages exist: BeforeSave, AfterSave, BeforeDelete and AfterDelete, each following its Do step outside the transaction.
  • BeforeSave is the only stage where a changed value reaches the database and the audit trail.
  • AfterSave runs after the commit: changing the DataSet is useless, only the RefreshedDataSet the caller receives matters.
  • PluginSettings stores a Type and a Stage per row, and one class carries exactly one stage.
  • A plugin class inherits FormBusinessPlugin and overrides the single stage declared in the settings file.
  • A type that cannot be loaded and a runtime exception both abort the operation, with no fallback or skip.

Real-world use

  • An extra credit limit check that must run before a save is committed
  • Syncing a saved document into an external system such as a CRM or a BPM approval flow
  • Sending a warehouse notice when a record is deleted through an AfterDelete plugin
  • Writing delivery dates from the ERP into Outlook or Google Calendar

This summary was generated by the agent from the original post on DEV Community: #dotnet. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message