依赖注入 批量注册


 public static Dictionary NewGetImpleAndInterfaces(string assemblyName, string suffix)
        {
            if (!String.IsNullOrEmpty(assemblyName))
            {
                var result = new Dictionary();
                foreach (var item in Assembly.Load(assemblyName)
                    .GetTypes()
                    .Where(x => !x.IsInterface && x.Name.Contains(suffix) && !x.IsGenericType)
                    .ToList())
                {
                    result.Add(item, item.GetInterfaces());
                }
                return result;
            }
            return new Dictionary();
        }

相关