/// <summary> /// 查找API /// </summary> public void Discover(Type type) { logger = DependencyHelper.LoggerFactory.CreateLogger <ApiDiscover>(); Assembly = type.Assembly; XmlMember.Load(Assembly); if (type.IsSupperInterface(typeof(IApiController))) { FindApi(type); } }
/// <summary> /// 查找API /// </summary> public void Discover(Assembly assembly) { logger = DependencyHelper.LoggerFactory.CreateLogger <ApiDiscover>(); XmlMember.Load(assembly); Assembly = assembly; var types = Assembly.GetTypes().Where(p => p.IsSupperInterface(typeof(IApiController))).ToArray(); foreach (var type in types) { FindApi(type); } }
/// <summary> /// 查找API /// </summary> public static void FindApies(Assembly asm) { var discover = new ApiDiscover { Assembly = asm }; try { XmlMember.Load(asm); discover.FindApies(); } catch (Exception e2) { discover.logger.Debug(e2.ToString()); } }
/// <summary> /// 构造 /// </summary> static ApiDiscover() { XmlMember.Load(typeof(IMessageItem).Assembly); XmlMember.Load(typeof(ApiExecuter).Assembly); }