Esempio n. 1
0
        private ImmutableDictionary <string, DataViewDelegateInfo> GetDataViewDelegates()
        {
            if (Type == GraphType.None)
            {
                return(ImmutableDictionary.Create <string, DataViewDelegateInfo>(StringComparer.OrdinalIgnoreCase));
            }

            var rawDelegateInfos = Type == GraphType.PXGraph
                                ? Symbol.GetViewDelegatesFromGraph(ViewsByNames, _pxContext, _cancellation)
                                : Symbol.GetViewDelegatesFromGraphExtensionAndBaseGraph(ViewsByNames, _pxContext, _cancellation);

            return(rawDelegateInfos.ToLookup(d => d.Item.Symbol.Name, StringComparer.OrdinalIgnoreCase)
                   .ToImmutableDictionary(group => group.Key,
                                          group => CreateViewDelegateInfo(group.First()),
                                          keyComparer: StringComparer.OrdinalIgnoreCase));


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

                DataViewDelegateInfo baseDelegateInfo = item.Base != null
                                        ? CreateViewDelegateInfo(item.Base)
                                        : null;

                return(baseDelegateInfo == null
                                        ? new DataViewDelegateInfo(node, method, item.DeclarationOrder)
                                        : new DataViewDelegateInfo(node, method, item.DeclarationOrder, baseDelegateInfo));
            }
        }
 public DataViewDelegateInfo(MethodDeclarationSyntax node, IMethodSymbol symbol, int declarationOrder, DataViewDelegateInfo baseInfo)
     : this(node, symbol, declarationOrder)
 {
     baseInfo.ThrowOnNull(nameof(baseInfo));
     Base = baseInfo;
 }