/// <summary>
        /// 注册 程序集
        /// </summary>
        public static IEnumerableRegistration RegisterAssembly(this IDependencyRegister dependencyRegister, Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            var enumerableConfiguration = DependencyRegistrationFactory.ForAssembly(assembly);

            return(RegisterCollection(dependencyRegister, enumerableConfiguration));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///    注册程序集中使实现特定接口或基类的类型作为依赖服务
        /// </summary>
        /// <exception cref="ArgumentNullException"></exception>
        public static IEnumerableRegistration RegisterAssembly(this IDependencyRegister dependencyRegister, Type baseType, params Assembly[] assemblys)
        {
            if (baseType == null)
            {
                throw new ArgumentNullException(nameof(baseType));
            }
            if (assemblys == null)
            {
                throw new ArgumentNullException(nameof(assemblys));
            }

            var enumerableConfiguration = DependencyRegistrationFactory.ForAssembly(assemblys, baseType);

            return(RegisterCollection(dependencyRegister, enumerableConfiguration));
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     注册程序集中使用特定命名约定的类型作为依赖服务
        /// </summary>
        /// <exception cref="ArgumentNullException"></exception>
        public static IEnumerableRegistration RegisterAssembly(this IDependencyRegister dependencyRegister, string name, params Assembly[] assemblys)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (assemblys == null)
            {
                throw new ArgumentNullException(nameof(assemblys));
            }

            var enumerableConfiguration = DependencyRegistrationFactory.ForAssembly(assemblys, name);

            return(RegisterCollection(dependencyRegister, enumerableConfiguration));
        }