a.m. wrote:
Anton, thanks a lot for the suggestion! But we've decided not to mark these methods as public. Otherwise, we'll have to mark all protected methods as public (in the entire solution) just in case of someone could use it. I hope for your understanding
Hi Andrei,
Please note that we don't ask you to change all protected methods to public in the entire solution.
We only want the ones in the Model factories to be public.
Of course, we understand that since they are not used from outside they should be protected but from an extensibility point of view, we think that it makes sense to make them public.
Since these factories contain common logic that is used in the controllers and components of nopCommerce then it is quite useful for plugin developers to "re-use" this logic.
Otherwise, we will need to "copy" this logic and duplicate that code in our plugins.
Of course, we can easily do that but the problem is that if someone overrides these factories with their own implementation then they will not be able to have their custom logic in our plugins (since we will not use the factories but our own "copy" of the logic).
Basically, we are now going a few years back and be in the situation we were in the previous versions of nopCommerce when the logic was in protected methods in the controllers and we had to inherit from the controllers in order to reuse the logic. At least then the logic was shared since we inherited the controllers and reused the same protected methods but now we can't reuse it.
Now the logic is properly extracted into model factories but they are not easily accessible.
I hope you will reconsider this and make an exception for the methods in the Model factories.
Even if the nopCommerce team does not use these methods outside of the factories it doesn't mean that we (as plugin developers) won't need to use them in our plugins (actually we use them a lot).
Thanks a lot!
Boyko