/// <summary> /// Add Type to service collection based on default convention and <see cref="ServiceLifetime"/> /// </summary> /// <param name="services"></param> /// <param name="type"></param> /// <param name="optionsAction"></param> public static IServiceCollection AddTypeOf(this IServiceCollection services, Type type, Action <MiLibScanOptions> optionsAction = null) { _options = new MiLibScanOptions(); optionsAction?.Invoke(_options); AddType(services, type); return(services); }
/// <summary> /// Add all classes in assembly automatically to service collection based on default convention and <see cref="ServiceLifetime"/> /// </summary> /// <param name="services"></param> /// <param name="assembly"></param> public static IServiceCollection AddAssembly(this IServiceCollection services, Assembly assembly) { _options = new MiLibScanOptions(); return(ScanAndRegisterAssemblies(services, new[] { assembly })); }
/// <summary> /// Scan supplied assemblies and bind them automatically to service collection based on convention and <see cref="ServiceLifetime"/> /// </summary> /// <param name="services"></param> /// <param name="assemblies"></param> /// <param name="optionsAction"></param> public static IServiceCollection ScanForDependency(this IServiceCollection services, IEnumerable <Assembly> assemblies, Action <MiLibScanOptions> optionsAction = null) { _options = new MiLibScanOptions(); optionsAction?.Invoke(_options); return(ScanAndRegisterAssemblies(services, assemblies)); }