In my work, I have that CommandClass
attribute attached to a single class, as provided by the wizard I used to start.
Inside that command class, I put the commands, ALL of them.
Each one with the CommandMethod
attribute.
So they are not attached to any object or view (and I really thought that was only possible using VBA, not .NET)
But their code is not written in there, I make different classes to manage the commands, so the main command class works mostly like a command index, each command calling its respective body in different classes I made for my own purposes.
So, in your place, I'd probably make a MyCommands
with CommandClass
attibute having all commands. Each command simply calls the command body from the ViewCommands
class below.
Create a ViewCommands
class (and many others you need to make it easy for your model).
This class doesn't
have the CommandClass
attribute, just have regular methods.
It will have the core of the commands to be called from CommandClass
methods.
I never tried to work with more than one CommandClass
, and I do believe it's better to concentrate all commands in a single place, to keep a good track of what your addin makes.