
Hi,
I am planning to structure my code inside plugin and custom workflow, so that I don't have to push all my code into the Execute block.
Do you have any suggestions (like using design patterns, dependency injection etc..) so that the code can be better structured and more readable?
Any code samples will be of real help.
*This post is locked for comments
I have the same question (0)Hi,
The scale of the supporting structure shouldn't eclipse the actual work you're doing for the plugins. I hate coming into a project where somebody over-architected a solution that is so configurable or structured that it's unusable.
If you have a very large implementation, you can use a factory to get the right plugin for your code. So you just have one plugin class that uses a factory for "contact" and the "Pre-create" event, and the plugin passes it off to that class. It's a quick and easy way to isolate the different callout events.
If it's small and you just have some shared functionality, create a base class for your common stuff or write extension methods to call into with your records.
Hope this helps! I'd appreciate if you'd mark this as Answering your question.
Thanks,
Aiden