Search code examples
c#version-controldeploymentdependency-injectionstrategy-pattern

Is replacing strategies injected via a DI container a valid deployment mechanism?


I'm creating an application which uses a DI Container for injecting strategies into it. When deployed, if I require those strategies to change, is it a valid deployment strategy to deploy a new assembly with the new strategies and ammend the configuration file for instructing the DI container of which strategy to use?

My concern is that Versioning of the application on a machine then becomes a bit fuzzy as different dlls would have different version numbers.


Solution

  • This is totally valid, this even is one of the great benefits of Dependency injection: It allows for modular development - and therefore also deployment: you don't have to deploy all of your application, but only the modified assembly (with the new strategies in your case).

    As for the versioning issue: It's common practice that an application consists of many software modules (vulgo: assemblies), which have a different version number. That's the rule, not something exceptional. Therefore, a list of version numbers for all DLLs is crucial...

    Thomas