/// <summary> /// Permet de retourner la liste des methodes d'evaluation disponibles dans les types fournis. /// </summary> /// <param name="types"></param> /// <returns></returns> private IEnumerable <(Type, ExposeClassAttribute, ExposeMethodAttribute, MethodInfo)> GetActions_Impl(BindingFlags bindings, params Type[] types) { var _result = new List <(Type, ExposeClassAttribute, ExposeMethodAttribute, MethodInfo)>(); var _types = new ExposedTypes() .GetTypes() .Where(c => types.Contains(c.Key)) .ToList(); foreach (var u in _types) { var type = u.Key; foreach (ExposeClassAttribute attribute in u.Value) { if (attribute.Context == Context) { var items = MethodDiscovery.GetMethods(type, bindings, returnType, methodSign); foreach (var method in items) { var attribute2 = method.GetCustomAttribute <ExposeMethodAttribute>(); if (attribute2 != null && (string.IsNullOrEmpty(Context) || attribute2.Context == Context)) { _result.Add((u.Key, attribute, attribute2, method)); } } } } } return(_result); }
/// <summary> /// Permet de retourner la liste des methodes d'evaluation disponibles dans les types fournis. /// </summary> /// <param name="types"></param> /// <returns></returns> private IEnumerable <BusinessAction <T> > GetActions_Impl <T>(BindingFlags bindings, params Type[] types) { var _result = new List <BusinessAction <T> >(); var _types = new ExposedTypes() .GetTypes() .Where(c => types.Contains(c.Key)) .ToList(); foreach (var u in _types) { var type = u.Key; foreach (ExposeClassAttribute attribute in u.Value) { string name = attribute.Name ?? type.Name; var items = MethodDiscovery.GetMethods(type, bindings, returnType, methodSign); foreach (var method in items) { RegisterMethodAttribute attribute2 = TypeDescriptor.GetAttributes(method).OfType <RegisterMethodAttribute>().FirstOrDefault(); if (attribute2 != null && (string.IsNullOrEmpty(Context) || attribute2.Context == Context)) { _result.Add(new BusinessAction <T> { Name = $"{name}.{attribute2.DisplayName}", Method = method, Type = type, RuleName = attribute2.DisplayName, Origin = $"Assembly {type.AssemblyQualifiedName}", Context = attribute2.Context, }); } } } } return(_result); }