Consistently expose Service classes #13993
Replies: 1 comment 2 replies
-
Hi @LennardF1989. This is a bit more complex IMO. The more public, the harder it is to maintain and the less things can be released to minor versions, due to us not being able to change signatures. We already do lots of things to avoid breaking changes, and that makes all tasks a bit bigger. From a "Umbraco as a product" point of view. We would like everything to be sealed internal and only interfaces to be public due to the performance benefits. That said, we would like to make it more consistent, but depending on the direction. This will be breaking changes. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Right now the code-base of Umbraco is all over the place.
UserService
)AuditService
)ContentService
)With proper dependency injection, it can be desirable to replace these services with an own implementation. But right now, for some of these you are forced to make proxy classes to be able to do so. Whereas in most cases being able to extend the original class and then override a single method through the interface is all that is needed.
In my situation, I now have to override one particular function in the
UserService
, so I have to make aProxyUserService : IUserService
, get an instance of the originalUserService
(eg. through reflection), and then proxy all methods. This results in a 230-something LoC class, while this could have been a few lines.IMO: There is no reason to make things either sealed or internal other than making it hard on the developer, as there are always (convoluted) ways around it. If someone goes down the route of replacing something, they will most likely have a very good reason to do so and it's on them to make sure it remains working if Umbraco HQ changes something.
Beta Was this translation helpful? Give feedback.
All reactions