/// <summary> /// Try add Scoped /// </summary> /// <param name="bag"></param> /// <typeparam name="TImplementationSelf"></typeparam> /// <exception cref="ArgumentNullException"></exception> public static void TryAddScoped <TImplementationSelf>(this R bag) { bag.CheckNull(nameof(bag)); bag.TryRegister(DependencyProxyDescriptor.CreateForInstanceSelf <TImplementationSelf>(DependencyLifetimeType.Scoped)); }
/// <summary> /// Add singleton /// </summary> /// <param name="bag"></param> /// <typeparam name="TImplementationSelf"></typeparam> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static R AddSingleton <TImplementationSelf>(this R bag) { bag.CheckNull(nameof(bag)); bag.Register(DependencyProxyDescriptor.CreateForInstanceSelf <TImplementationSelf>(DependencyLifetimeType.Singleton)); return(bag); }