I am trying to use the command template for the first time, and with it I create the factory command, I follow the instructions on the multipalsight.com course, where it implements the interface for the factory, which includes the MakeCommand method.
Now my problem is that it simply passes an array of strings as arguments for this method (its a command line application), however my commands will use many arguments from different types, my plan was to use these commands to store updates for models therefore, if the application cannot connect to the services, the commands will be queued when the connection returns.
This has always been a great moment for me with common interfaces, how can I deal with many possible arguments?
My first thought was to pass the model itself with a simple string argument with the command type (Delete, Update, etc.), however, since my models do not have a common base class or interface, I remain with a similar problem.
Did I miss something basic here?
EDIT: An example of my problem was requested.
I have a CommandFactory interface per se
public interface ICommandFactory { string CommandName { get; } string Description { get; } ICommand MakeCommand( ..arguments.. ) }
And I have simple models like (pure example)
public class Model1 { public string Name {get;set;} public int Age {get;set;} } public class Model2 { public DateTime Time {get;set;} public double Price {get;set} }
If I wanted to create a team that, for example, updated model1, Iβm not interested in what the MakeCommand interface should look like, I canβt do MakeCommand (cmdType line, model Model1), because I have several different models that share no common base class / interface