Skip to content
This repository was archived by the owner on Apr 5, 2021. It is now read-only.

Latest commit

 

History

History
115 lines (77 loc) · 2.12 KB

File metadata and controls

115 lines (77 loc) · 2.12 KB

ISimpleDependencyService interface

Namespace: MADE.App.Dependency

Defines an interface for a simple dependency service.

public interface ISimpleDependencyService

Supported platforms

Platform Version
.NET Standard 2.0
Xamarin.Android 8.1
Xamarin.iOS 1.0
UWP 10.0.16299

Methods

Register()

Registers the given type.

void Register<TClass>() where TClass : class;

Register<TInterface, TClass>()

Registers the given interface and associated type.

void Register<TInterface, TClass>()
            where TInterface : class 
            where TClass : class, TInterface;

Register(Func)

Registers the given type with the given factory.

void Register<TClass>(Func<TClass> factory);

Parameters

factory (Func)

The factory for creating instances of the given type.

Register(string, Func)

Registers the given type with the given factory and associates it with the given key.

void Register<TClass>(string key, Func<TClass> factory);

Parameters

key

The key associated with the registration.

factory (Func)

The factory for creating instances of the given type.

GetInstance()

Gets an instance of the given service type that is registered.

TService GetInstance<TService>();

Returns

A registered instance of the given service.

GetInstance(string)

Gets an instance of the given service type that is registered.

TService GetInstance<TService>(string key);

Parameters

key

The key of the instance to retrieve.

Returns

A registered instance of the given service.

IsRegistered()

Checks whether the given type is registered with the service.

bool IsRegistered<T>();

Returns

True if the type is registered; otherwise, false.

IsRegistered(string)

bool IsRegistered<T>(string key);

Parameters

key

The key of the instance to check is registered.

Returns

True if the type is registered; otherwise, false.