Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8: IEmailSender not registered in DI container #11206

Closed
mattbrailsford opened this issue Sep 27, 2021 · 4 comments
Closed

v8: IEmailSender not registered in DI container #11206

mattbrailsford opened this issue Sep 27, 2021 · 4 comments
Labels

Comments

@mattbrailsford
Copy link
Contributor

Which exact Umbraco version are you using? For example: 8.13.1 - don't just write v8

Umbraco v8.17.0-rc2

Bug summary

Umbraco has a IEmailSender for helping sending emails, but this isn't registered in the DI container like it is in v9. It currently requires use of a hard coded EmailSender class.

Specifics

No response

Steps to reproduce

Accept an IEmailSender constructor dependency.
Run application
Get error because it's not registered in container

Expected result / actual result

IEmailSender should be registered with the DI container and should successfully resolve as a constructor arg.

nul800sebastiaan added a commit that referenced this issue Sep 30, 2021
IEmailSender not registered in DI container
nul800sebastiaan added a commit that referenced this issue Sep 30, 2021
IEmailSender not registered in DI container
nul800sebastiaan added a commit that referenced this issue Sep 30, 2021
@nul800sebastiaan
Copy link
Member

I made a bit of a mess but with some help from @p-m-j I got there in the end! Thanks for the report @mattbrailsford! 👍

@nul800sebastiaan
Copy link
Member

Fixed in #11206 for 8.17.0.

@p-m-j
Copy link
Contributor

p-m-j commented Sep 30, 2021

Don't think you made a mess at all @nul800sebastiaan, the static helpers for services were the idiomatic way to work in umbraco for so long and I don't think there would have been a problem with adding one as long as the service was registered in the container.

Edit: Not having them is also fine, we should be encouraging constructor injection, especially for those preparing to move 8->9

@nul800sebastiaan
Copy link
Member

Ah I was just referring to the mess with multiple PRs and forgetting to revert stuff. The final commit is nice and clean!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants