realitycollective / com.realitycollective.service-framework

The Service Framework package components for the Reality Collective. This package an extensible service framework to build highly performant components for your Unity projects.
https://service-framework.realitycollective.net
MIT License
9 stars 5 forks source link

Enable searching for inherited services #110

Closed SimonDarksideJ closed 2 weeks ago

SimonDarksideJ commented 2 weeks ago

Reality Collective - Service Framework Pull Request

Overview

In cases where you want a generic search for services implemented with a base interface, this change enables this capability, e.g.

Base Interface : IApplicationSettings Generic Interface : IMyApplicationSettings : IApplication Settings.

Now the service is searchable by either its base interface "IMyApplicationSettings" or its inherited interface "IApplicationSettings".

Warning, if there are multiple services registered with the same inherited interface, ONLY the first registered instance would be found. To get all services returned with the inherited interface, then "GetAllServices" should be used.

Changes

Breaking Changes

Testing status

Breaking change

Should implementations expect a failure where inherited services look for a single service, these will now return the first service with the inherited interface.

FejZa commented 2 weeks ago

Looks good and should not be breaking anything.