So I have my first plugin working (yeah me).
I've included both the "Create" and "Update" logic for an Entity in the same class.
This got me thinking. How to design a plugin.
Should you only create one plugin per entity and use code in the execute method to determine if the call is a PreValidation or Postvalidation and then test for the message type "Create", "update" etc.
Then branch off to methods\ non plugin classes that cater for each combination of options.
Here you know where the first call will be for every occurrence.
Or, should you breakdown the plugins for each entity into Post and pre validation and then the message type. eg.
PersonPreCreate.cs PersonPreUpdate.cs
is there a best practice ?
The answer , "it depends on the situation" could be true.
But for large organisations with multiple developer groups, commonality of design would help with learning curves, so would take preference over individual style.