Table of Contents

Class Locator

Namespace
Splat
Assembly
Splat.dll

A Locator which will host the container for dependency injection based operations.

public static class Locator
Inheritance
Locator

Properties

Current

Gets the read only dependency resolver. This class is used throughout libraries for many internal operations as well as for general use by applications. If this isn't assigned on startup, a default, highly capable implementation will be used, and it is advised for most people to simply use the default implementation.

public static IReadonlyDependencyResolver Current { get; }

Property Value

IReadonlyDependencyResolver

The dependency resolver.

CurrentMutable

Gets the mutable dependency resolver. The default resolver is also a mutable resolver, so this will be non-null. Use this to register new types on startup if you are using the default resolver.

public static IMutableDependencyResolver CurrentMutable { get; }

Property Value

IMutableDependencyResolver

Methods

AreResolverCallbackChangedNotificationsEnabled()

Indicates if the we are notifying external classes of updates to the resolver being changed.

public static bool AreResolverCallbackChangedNotificationsEnabled()

Returns

bool

A value indicating whether the notifications are happening.

GetLocator()

Gets the full locator. Note you should use Current or CurrentMutable in most situations.

public static IDependencyResolver GetLocator()

Returns

IDependencyResolver

The locator.

RegisterResolverCallbackChanged(Action)

This method allows libraries to register themselves to be set up whenever the dependency resolver changes. Applications should avoid this method, it is usually used for libraries that depend on service location.

public static IDisposable RegisterResolverCallbackChanged(Action callback)

Parameters

callback Action

A callback that is invoked when the resolver is changed. This callback is also invoked immediately, to configure the current resolver.

Returns

IDisposable

When disposed, removes the callback. You probably can ignore this.

SetLocator(IDependencyResolver)

Allows setting the dependency resolver.

public static void SetLocator(IDependencyResolver dependencyResolver)

Parameters

dependencyResolver IDependencyResolver

The dependency resolver to set.

SuppressResolverCallbackChangedNotifications()

This method will prevent resolver changed notifications from happening until the returned IDisposable is disposed.

public static IDisposable SuppressResolverCallbackChangedNotifications()

Returns

IDisposable

A disposable which when disposed will indicate the change notification is no longer needed.