Skip to content

DI and Simple Code #185

Answered by christiannagel
ShervanN asked this question in Q&A
Discussion options

You must be logged in to vote

What do you mean by "is it true"?
Regarding dependency injection - yes, you inject the EmailService wich implements IEmail into the Email class. You can create different providers implementing IEmail (e.g. a test provider, a provider using SMPT, a provider using Office 365...), and use all these with your Email class.

I just would rename the IEmail interface to IEmailSender. With IEmail I would think more about the email content such as addresses, header, content...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ShervanN
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