Dependency Injection when using the Command Pattern
问题 I'm using the Command Pattern for the first time. I'm a little unsure how I should handle dependencies. In the code below, we dispatch a CreateProductCommand which is then queued to be executed at a later time. The command encapsulates all the information it needs to execute. In this case it is likely we will need to access a data store of some type to create the product. My question is, how do I inject this dependency into the command so that it can execute? public interface ICommand { void