Skip to content

How are instantiated the commands

Matthias GROSPERRIN edited this page Apr 2, 2017 · 1 revision

Once the correct command has been identified by the parser, an instance of it should be created. This is done by calling the CreateCommandmethod on the MGR.CommandLineParser.CommandType. The methods will used the MGR.CommandLineParser.ICommandActivator to create the instance.

There is two built-in implementation of this interface:

  • MGR.CommandLineParser.BasicCommandActivator (the default): this implementation will create the instance by using System.Activator.CreateInstance (so, the command should have a default parameterless constructor).
  • MGR.CommandLineParser.DependencyResolverCommandActivator: uses the dependency resolver to create the instance of the command (via the IDependencyResolverScope.ResolveDependency method, see dependency resolver for more info).
Clone this wiki locally