Skip to content

Having problems with IoC #446

Answered by drewburlingame
MiniaczQ asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, the code example was helpful and I understand why it's failing for you. We have not added support to resolve method parameters from the container. If we did, we might follow the pattern of ASP.NET and require the parameter to be attributed with [FromServices] (You could propose this as a feature and submit a PR if you'd like)

CommandDotNet expects the command class to be created by the DI container and in that case, you'd inject the dependencies via constructor or property injection, depending on what you've enabled in the container. This way, the DI container owns the instance of the command class. In your example, Program is a command class since it defines commands.

public class Pr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@drewburlingame
Comment options

Answer selected by drewburlingame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants