Is there support for Dependency Injection
See original GitHub issueWhen constructing the instance of from the array of types provided to the ParseArguments
it would be nice if the instance supplied had it’s dependencies resolved via constructor arguments. Perhaps this is already in place and I’m just not seeing how it’s configured?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:10
- Comments:10
Top Results From Across the Web
Dependency injection - .NET
.NET supports the dependency injection (DI) software design pattern, which is a technique for achieving Inversion of Control (IoC) between ...
Read more >When is it not appropriate to use the dependency injection ...
An alternative to Dependency Injection is using a Service Locator. A Service Locator is easier to understand, debug, and makes constructing ...
Read more >Dependency Injection with Code Examples
Dependency injection supports these goals by decoupling the creation of the usage of an object. That enables you to replace dependencies without changing ......
Read more >Understanding Dependency Injection in .NET Core
NET Core provides you with extensive support to Dependency Injection, but it may not always be clear how to apply it. This tutorial...
Read more >A Practical Introduction To Dependency Injection
We're going to look at a few more practical examples that hopefully help to explain, again intuitively, why dependency injection is useful.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m a huge fan of Micorosft’s DI so I ended up writing my own DI extension for CommandLineParser. You’re welcome to try it out for yourself here: https://github.com/JaronrH/CommandLineParser.DependencyInjection
If you want to manually control what gets pulled into DI, just use AddCommandLineParser() without passing in any assemblies and then register the implementations yourself.
Note: If you want the help information dispatched to the console, you will need to specify that in the configuration. For example:
parser.ParseArguments(args, o => { o.HelpWriter = System.Console.Error; });
Hope that helps!
i haven’t looked at the library code yet, but i think you can keep single responsibility and without adding aspnetcore dependency. How? Allowing us to intervene between data type detection and creation of the instance
commandlineparser
commandlineparser
populates propertiesthoughts?