Example #1
0
        /// <summary>
        /// 解析程序集列表
        /// </summary>
        /// <param name="asses"></param>
        /// <param name="target"></param>
        /// <param name="validate"></param>
        /// <returns></returns>
        public static List <ServiceModel> ResolveAssemblyList(IEnumerable <Assembly> asses, AttributeTargets target, Func <Type, bool> validate)
        {
            List <ServiceModel> services = new List <ServiceModel>();

            foreach (var ass in asses)
            {
                if (ass.FullName.StartsWith("System."))
                {
                    continue;
                }
                AssemblyResolver resolver = new AssemblyResolver(ass);
                var list = resolver.Resolve(target, validate);
                services.AddRange(list);
            }
            foreach (var service in services)
            {
                ServiceCacheManager.Set(service.ID, service);
            }
            return(services);
        }
Example #2
0
 /// <summary>
 /// 获得已解析的所有接口
 /// </summary>
 /// <returns></returns>
 public static List <ServiceModel> GetServiceListFromCache()
 {
     return(ServiceCacheManager.GetList());
 }
Example #3
0
 /// <summary>
 /// 获得接口服务信息
 /// </summary>
 /// <param name="serviceId"></param>
 /// <returns></returns>
 public static ServiceModel GetServiceFromCache(string serviceId)
 {
     return(ServiceCacheManager.Get(serviceId));
 }