/// <summary> /// Inject class to interface with ServiceLifetime. /// </summary> /// <typeparam name="TInterface"></typeparam> /// <typeparam name="TConcrete"></typeparam> /// <param name="services"></param> /// <param name="option"></param> /// <returns></returns> public static IServiceCollection BindType <TInterface, TConcrete>(this IServiceCollection services, Action <DependencyOption> option = null) { using (DependencyOptionBuilder builder = new DependencyOptionBuilder(services)) { builder.Bind <TInterface, TConcrete>(option); return(services); } }
/// <summary> /// Types which implements ITransientType,IScopedType,ISingletonType interfaces, inject automatically in this method. /// If namepace is null, all classes injects, but if namespace is not null classes inject only in this namepace. /// </summary> /// <param name="services"></param> /// <param name="option"></param> /// <returns></returns> public static IServiceCollection AutoBind(this IServiceCollection services, Action <DependencyOption> option = null) { using (DependencyOptionBuilder builder = new DependencyOptionBuilder(services)) { builder.AutoBind(option); return(services); } }