-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add NullMediaFileStoreCache to avoid injecting IServiceProvider #15391
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd wait with this until #15276 is merged.
src/OrchardCore.Modules/OrchardCore.Media/Services/RemoteMediaCacheBackgroundTask.cs
Outdated
Show resolved
Hide resolved
:) We could use feature dependency as you said but this is useful for 3rd-party media providers |
How about following the providers pattern (used in email PR) here too? |
I'm not sure if it's a good idea to use the Provider Model everywhere, that's why I'm suggesting Null Object Pattern |
I'm not sure if it's a good idea to use the Null Object Pattern everywhere, that's why I'm suggesting Provider Model. 🤣 |
No problem bro, let's hear the other's feedback |
@Piedone can we have a look to this again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test this with AWS and Azure Media?
As for the provider pattern: this PR is about addressing something that's more of an aesthetic issue and I imagine it's only a more serious problem in extreme cases (I certainly haven't encountered any, nor can imagine one, even after working a lot with Media feature set in the last two years or so). The fix prevents potential NREs and DI resolution exceptions and is fine for that IMO.
I don't see any necessity to add any further complexity and would advise anybody against it too. If you'd like to, feel free, of course, but due to this and because I don't see this as a high-priority problem, I won't be able to allocate time to collaborate on it.
{ | ||
_authorizationService = authorizationService; | ||
// Resolve from service provider as the service will not be registered if configuration is invalid. | ||
_mediaFileStoreCache = serviceProvider.GetService<IMediaFileStoreCache>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The nullcheck below should be adjusted too.
@MikeAlhayek while @Piedone doesn't have much time on this, can we use the Null Object Pattern or any other approach instead if using |
So, any news here? After #15391 (comment) I'm OK to merge this but only if as mentioned under #15391 (review) you confirm that you also tested it with both providers. |
I can continue in this PR but my issue with testing with the underlying providers coz I didn't work with both Azure & S3 storage |
Time to start now, then :). |
While I don't have much experience with Azure & S3 storage media providers I might need to hand over this PR, or let someone to try it |
Let's close this, then. |
IMHO it's better to leave this open, so anyone can test if possible instead of not doing anything at all |
In the last two months, nobody else came forward with an interest in this PR. What do we hope from keeping it open, and for how long? |
While the PR change the pattern nothing related to the media itself, I hope to revise it in the upcoming month |
Introduce a Null Object Pattern for
IMediaFileStoreCache
to avoid injectingIServiceProvider