-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Netcore: Remove internal composers #9446
Comments
I think this is something someone can do from startup if they require directly against the builder there. If we do what I propose re collections there will be no complexity whatsoever. |
This is the workaround for no code late reg, should only be used by plugin devs. @Shazwazza what was the point of this again? Why would Our.Umbraco.Bar want to overrule Our.Umbraco.Foo on a registration, and what happens when Our.Umbraco.Foo pushes an update to use the late reg. Why would we handle the 1st case but not the nth case, perhaps better to not worry about it at all. |
I thought we'd already established that this was an edge case not worth the effort and that if someone explicitly wanted to do that they use startup? Plugin devs won't be doing stuff like that anyway. Most plugins are property value converters. |
The last said on the matter was #8653 (comment)
|
I really don't think it's worth the effort. |
I thought of an example: an Umbraco Forms addon packages. Umbraco Forms itself is a package and there's a possibility that an addon package author would want to replace a service shipped with Umbraco Forms. Another similar example could be a Vendr (https://vendr.net/) addon package that might want to replace a service shipped with that ecom engine. The OnContainerBuilder example was just an idea to potentially assist with this edge case and I know that this doesn't 'solve' the case at all if 2x addons are trying to replace the same service. Its the same issue there is today with before/after thing. The only real solution is the end user calling a method in their startup. So...
Agree :)
Agree :) |
Just leaving a few open ended cents again. I had a chat with @callumbwhyte since I know he's done quite a few things where I'm thinking that most, if not all of those cases, are due to legacy framework stuff and basically just not DI-compatible architecture in both Umbraco and the plugins. Why shouldn't ExamineManager already be ready if it's ready to be injected? It could at least lazy initialize instead of having a temporal coupling to its component. Or be initialized in a factory method. The big question then ends up "do we force everyone to change architecture in order to make Umbraco startup totally non temporal for plugins?" On a sidenote, interception and decoration would pretty much solve all of this. The only showstopper is if two plugins decorate the same concrete class, then the implementor would be forced to actually modify the composition during startup. |
YES!! |
Examine is in core, so its Component (assuming they survive) would always init before an IUmbracoComposer added component. I'm not sure if there's an issue here @lars-erik? Only remaining concern is a package replacing uniques added by another package, e.g Shannons example of someone extending Umbraco.Forms but the current consensus is it's not worth worrying about. Core stuff should always be ready in time for downstream stuff. |
Yes, the only reason people have to hack things with
YES I agree. Though it's still not going to be a huge change and will be less confusing. Also I've seen a number of people doing
indeed - essentially it would be like today's IUserComposer. There are 2 strange things I've just remembered though. This is just something we need to fix/review internally but essentially there is some core code that currently needs to execute after all plugin components and user startup.
|
Had a first hack at this, starts to become a problem at ModelsBuilderComposer (Models builder depends on Umbraco.Web.BackOffice, but BackOffice would be registering once composers are gone) I can yank AddAllBackOfficeComponents and AddUmbracoCore upto Umbraco.Web.UI.NetCore and everything would work, anyone got any better ideas? |
Yep. Examine constructor injects Examine should have it's own events. |
That’s presumably the way you solve it in the other ticket about removing static events. For now in this issue you would just call builder.Components.append<examine final> after builder.AddComposers. |
Are we doing these in the right order? It seems to me the code will be fixed twice? |
I think that’s a reasonable argument, don’t need to move component registrations when components no longer exist. However whilst the other issue has a couple of thumbs up, I don’t feel like the strategy is set in stone or approved so this one feels like a quicker win. |
Rolls up sleeves 👷♂️ |
All internal composers are now removed... We need to be aware when we merge stuff from v8, so new ones are not introduced. |
Further enhancements to simplify the service registration story continuing on from #8653
We no longer require IComposer implementations in the Umbraco codebase, however the concept must continue to exist for plugin developers such that they can continue to support no-code installations.
Those with the ability to edit (or replace) Startup.cs should prefer Startup.ConfigureServices & extensions on IUmbracoBuilder to register their services over custom composer implementations.
The following tasks have been constructed based on discussion in #8653
Ordering of UmbracoBuilder extensions for adding core service shouldn't be important, why would Umbraco core replace its own registrations.
However, there may be some legacy cruft here so keep an eye out for duplicate registrations of services in the existing composers.
The text was updated successfully, but these errors were encountered: