Support registering named singleton

This commit is contained in:
Lars-Erik Aabech
2018-09-09 22:46:14 +02:00
parent bc80affcf1
commit 9da750c5c9

View File

@@ -105,6 +105,13 @@ namespace Umbraco.Core.Composing
public static void RegisterSingleton<TService>(this IContainer container, Func<IContainer, TService> factory)
=> container.Register(factory, Lifetime.Singleton);
/// <summary>
/// Registers a named singleton service with an implementation factory.
/// Note to implementors: The last registered component must be the default.
/// </summary>
public static void RegisterSingleton<TService>(this IContainer container, string name, Func<IContainer, TService> factory)
=> container.Register(factory, name, Lifetime.Singleton);
/// <summary>
/// Registers a service with an implementing instance.
/// </summary>