Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation - All Command constructors run when first Command is invoked. #362

Open
LeeMSilver opened this issue Apr 20, 2024 · 0 comments

Comments

@LeeMSilver
Copy link

I think it should be documented that all Command constructors run when the first Command is invoked.

Rationale: In most (all?) current multi-command extensions, each command does its own Dependency Injection (DI). In almost all cases there is no need for this. If no constructor is dependent on the DI then the DI can be done in any one command and the other command constructors do not have to be littered with the DI parameters and associated setting of fields/properties associated with the DI.

In my case, I have a non-invocable DependencyInjectionCommand whose constructor sets fields/properties in the class derived from Command from which all the Commands in the extension derive.

In the Samples, the CommentRemover can be easily modified to accomplish the above, thus fulfilling 2 objectives for it.

Note: If all the commands derive from a parent (P) which in turns derives from Command I would suggest keeping/making P abstract for the reason I will note in my next issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant