Core/CafeLib.Core.IoC/ServiceRegistry.cs
/// <summary>
/// Register service as a singleton.
/// </summary>
/// <typeparam name="TService">service type</typeparam>
/// <param name="factory">service factory</param>
/// <returns>service registry</returns>
Register service as a singleton.
Register service as a singleton .
public IServiceRegistry AddSingleton<TService>(Func<IServiceResolver, TService> factory) where TService : class
        {
            _serviceContainer.RegisterSingleton(_ => factory.Invoke(this));
            return this;
        }
public IServiceRegistry AddSingleton < TService > ( Func < IServiceResolver , TService > factory ) where TService : class { _serviceContainer . RegisterSingleton ( _ => factory . Invoke ( this ) ) ; return this ; }
Register service as a singleton.
Register service as a singleton .
None
factory
Func<IServiceResolver, TService>
None
typeparam
None