Ejemplo n.º 1
0
        private ImmutableDictionary <string, ActionHandlerInfo> GetActionHandlers()
        {
            if (Type == GraphType.None)
            {
                return(ImmutableDictionary.Create <string, ActionHandlerInfo>(StringComparer.OrdinalIgnoreCase));
            }

            var rawActionHandlerInfos = Type == GraphType.PXGraph
                                ? Symbol.GetActionHandlersFromGraph(ActionsByNames, _pxContext, _cancellation)
                                : Symbol.GetActionHandlersFromGraphExtensionAndBaseGraph(ActionsByNames, _pxContext, _cancellation);

            return(rawActionHandlerInfos.ToLookup(handler => handler.Item.Symbol.Name, StringComparer.OrdinalIgnoreCase)
                   .ToImmutableDictionary(group => group.Key,
                                          group => CreateActionHandlerInfo(group.First()),
                                          keyComparer: StringComparer.OrdinalIgnoreCase));

            ActionHandlerInfo CreateActionHandlerInfo(GraphOverridableItem <(MethodDeclarationSyntax, IMethodSymbol)> item)
            {
                var(node, method) = item.Item;

                ActionHandlerInfo baseActionHandlerInfo = item.Base != null
                                        ? CreateActionHandlerInfo(item.Base)
                                        : null;

                return(baseActionHandlerInfo == null
                                        ? new ActionHandlerInfo(node, method, item.DeclarationOrder)
                                        : new ActionHandlerInfo(node, method, item.DeclarationOrder, baseActionHandlerInfo));
            }
        }
Ejemplo n.º 2
0
 public ActionHandlerInfo(MethodDeclarationSyntax node, IMethodSymbol symbol, int declarationOrder, ActionHandlerInfo baseInfo) :
     this(node, symbol, declarationOrder)
 {
     baseInfo.ThrowOnNull(nameof(baseInfo));
     Base = baseInfo;
 }