/// <summary>添加瞬态实例,指定实现类型</summary> /// <typeparam name="TService"></typeparam> /// <param name="container"></param> /// <returns></returns> public static IObjectContainer AddTransient <TService>(this IObjectContainer container) where TService : class => container.AddTransient(typeof(TService), typeof(TService));
/// <summary>添加瞬态实例,指定实现工厂</summary> /// <typeparam name="TService"></typeparam> /// <param name="container"></param> /// <param name="factory"></param> /// <returns></returns> public static IObjectContainer AddTransient <TService>(this IObjectContainer container, Func <IServiceProvider, Object> factory) where TService : class => container.AddTransient(typeof(TService), factory);
/// <summary>添加瞬态实例,指定实现类型</summary> /// <typeparam name="TService"></typeparam> /// <typeparam name="TImplementation"></typeparam> /// <param name="container"></param> /// <returns></returns> public static IObjectContainer AddTransient <TService, TImplementation>(this IObjectContainer container) where TService : class where TImplementation : class, TService => container.AddTransient(typeof(TService), typeof(TImplementation));