we've got some plugins that are riddled with this kind of code:
controllers :
ActionResult RespondToSomeRequest(){
var plugin = MyPlugin.GetPluginIfEnabled(); <-- uses code like
var pluginDescriptor = _pluginFinder.GetPluginDescriptorBySystemName("MySystemName");
if (pluginDescriptor == null || _pluginFinder.AuthenticateStore(pluginDescriptor, _storeContext.CurrentStore.Id)==false)
return null;
else
return pluginDescriptor.Instance() as MyCreditPaymentProcessor;
Services have similar code
Events and overrides similar again... I think payments or shipping ones are subtly different, but I have done some tests and if the plugin is disabled then you can't GET to many of these elements so the checks are redundant in many cases...
I see there is a check like this in some of the built in plugins... but I couldn't see one that used it in more complex scenario (like our integration plugin that sends/recieves data to our admin tool.
...so where DO you need to put this check in?