Show / Hide Table of Contents

Interface IServiceLocator

The Service Locator patter. This pattern gives you a simple way to decouple dependencies. There are a lot props and cons about this patters but it's up to you to decide, if this pattern fits your project. Few articles we think it worth reading before using this pattern.

  • Service Locator is an Anti-Pattern
  • Service Locator is NOT an Anti-Pattern
Inherited Members
IReadOnlyServiceLocator.Get<T>()
IReadOnlyServiceLocator.Get(Type)
IReadOnlyServiceLocator.IsRegistered<T>()
IReadOnlyServiceLocator.IsRegistered(Type)
Namespace: StansAssets.Foundation.Patterns
Assembly: cs.temp.dll.dll
Syntax
public interface IServiceLocator : IReadOnlyServiceLocator

Methods

Clear()

Unregisters all the registered services in the current container.

Declaration
void Clear()

Register(Type, Object)

Registers the service with the current service locator.

Declaration
void Register(Type type, object service)
Parameters
Type Name Description
System.Type type

Service type.

System.Object service

Service instance.

Register<T>(T)

Registers the service with the current service locator.

Declaration
void Register<T>(T service)
Parameters
Type Name Description
T service

Service instance.

Type Parameters
Name Description
T

Service type.

Unregister(Type)

Unregisters the service from the current service locator.

Declaration
void Unregister(Type type)
Parameters
Type Name Description
System.Type type

Service type.

Unregister<T>()

Unregisters the service from the current service locator.

Declaration
void Unregister<T>()
Type Parameters
Name Description
T

Service type.

In This Article
Back to top Generated by DocFX