Init(args)
Scripting Reference
Loading...
Searching...
No Matches
Sisus.Init.IServiceProvider Interface Reference

Description

Represents a class responsible for providing service objects on request to any clients that need them.

A benefit of using IServiceProvider instead of a concrete class directly, is that it makes possible to create mock implementations of the interface for unit tests.

Additionally, it makes it easier to swap your service provider with another implementation at a later time.

A third benefit is that it makes your code less coupled with other classes, making it easier to do things such as port the code over to another project.

Inheritance diagram for Sisus.Init.IServiceProvider:
Sisus.Init.INullGuardByType Sisus.Init.ServiceProvider

Public Member Functions

bool TryGet< TService > ([NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get a service of type TService that is accessible to clients Clients.Everywhere .
 
bool TryGetFor< TService > ([DisallowNull] Component client, [NotNullWhen(true), MaybeNullWhen(false)] out TService service)
 Tries to get a service of type TService for the given client .
 
- Public Member Functions inherited from Sisus.Init.INullGuardByType
NullGuardResult EvaluateNullGuard< TValue > ([AllowNull] Component client)
 Gets a value indicating whether null guard passes for this object or not, and if not, what was the cause of the failure.