コード例 #1
0
 /// <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);
     }
 }
コード例 #2
0
        /// <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);
            }
        }
コード例 #3
0
        /// <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());
            }
        }
コード例 #4
0
 /// <summary>
 /// 构造
 /// </summary>
 static ApiDiscover()
 {
     XmlMember.Load(typeof(IMessageItem).Assembly);
     XmlMember.Load(typeof(ApiExecuter).Assembly);
 }