コード例 #1
0
        /// <summary> 初始化服务 </summary>
        private void InitServices()
        {
            if (_typeFinder == null)
            {
                return;
            }
            var services = _typeFinder
                           .Find(t => typeof(IMicroService).IsAssignableFrom(t) && t.IsInterface && t != typeof(IMicroService))
                           .ToList();

            foreach (var service in services)
            {
                if (!CurrentIocManager.IsRegisted(service))
                {
                    continue;
                }
                var methods = service.GetMethods(BindingFlags.Public | BindingFlags.Instance);
                foreach (var method in methods)
                {
                    var serviceId = GenerateServiceId(method);
                    _methods.TryAdd(serviceId, method);
                }
            }
        }