DI and Simple Code #185
-
Hi, I wrote the following code to learn Dependency Injection. Thanks
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
What do you mean by "is it true"? I just would rename the |
Beta Was this translation helpful? Give feedback.
What do you mean by "is it true"?
Regarding dependency injection - yes, you inject the
EmailService
wich implementsIEmail
into theEmail
class. You can create different providers implementingIEmail
(e.g. a test provider, a provider using SMPT, a provider using Office 365...), and use all these with yourEmail
class.I just would rename the
IEmail
interface toIEmailSender
. WithIEmail
I would think more about the email content such as addresses, header, content...