Beamable SDK
Public Member Functions | List of all members
Beamable.Server.IServiceInitializer Interface Reference

When creating a IServiceInitializer remember to inject a RequestContext using it's parameterless constructor. This is used to notify users they must call Microservice.AssumeUser before attempting to use certain user-specific routes. More...

Inheritance diagram for Beamable.Server.IServiceInitializer:
Inheritance graph
[legend]
Collaboration diagram for Beamable.Server.IServiceInitializer:
Collaboration graph
[legend]

Public Member Functions

TService GetServiceAsCache< TService > ()
 Gets a service registered during BeamableMicroService.InitServices. If you intend to cache data on the service, you must use a singleton service for that. This method can be used to explicitly guard against mistakenly getting a non-singleton service for cache-ing purposes. Functionally, there is no difference between this and GetService<TService>. There's just a guard baked in that you can use to declare that a specific service is being used as a Cache and, therefore, must have been added via IServiceBuilder.AddSingleton<T>(Beamable.Server.ServiceFactory<T>) or IServiceBuilder.AddSingleton<T>(). More...
 
TService GetService< TService > ()
 Gets a service registered during BeamableMicroService.InitServices. This assumes nothing about what you are using the service for and only guards against attempting to get a non-existent service. More...
 

Detailed Description

When creating a IServiceInitializer remember to inject a RequestContext using it's parameterless constructor. This is used to notify users they must call Microservice.AssumeUser before attempting to use certain user-specific routes.

Member Function Documentation

◆ GetService< TService >()

TService Beamable.Server.IServiceInitializer.GetService< TService > ( )

Gets a service registered during BeamableMicroService.InitServices. This assumes nothing about what you are using the service for and only guards against attempting to get a non-existent service.

Type Constraints
TService :class 

◆ GetServiceAsCache< TService >()

TService Beamable.Server.IServiceInitializer.GetServiceAsCache< TService > ( )

Gets a service registered during BeamableMicroService.InitServices. If you intend to cache data on the service, you must use a singleton service for that. This method can be used to explicitly guard against mistakenly getting a non-singleton service for cache-ing purposes. Functionally, there is no difference between this and GetService<TService>. There's just a guard baked in that you can use to declare that a specific service is being used as a Cache and, therefore, must have been added via IServiceBuilder.AddSingleton<T>(Beamable.Server.ServiceFactory<T>) or IServiceBuilder.AddSingleton<T>().

Type Constraints
TService :class 

The documentation for this interface was generated from the following file: