I am new to Inversion of Control (IoC), so I wanted to know how best to handle the case when I want to pass data structures / parameters, and also inject objects into the class.
A simple example:
public class EmailSender
{
public EmailSender(string toEmail, string Subject, String body,
ILogger emailLogger)
{.....}
}
What is the best strategy? I think this cannot be inserted directly?
I think I need to put all the string parameters as setters instead of just being Iloggerin the constructor or vice versa?
Or am I wrong?
Ps I know that the above example, and sucks toEmailand bodyshould be transferred to a separate method call, but it was just an example.
source
share