Beispiel #1
0
        public static INamedTypeSymbol TopMostContainingType(this ITypeSymbol type)
        {
            INamedTypeSymbol current = type.CheckIfNull(nameof(type)).ContainingType;

            while (current != null)
            {
                if (current.ContainingType == null)
                {
                    return(current);
                }

                current = current.ContainingType;
            }

            return(null);
        }
 /// <summary>
 /// Gets the DAC extension type with its base types up to first met <c>PX.Data.PXCacheExtension</c>.
 /// </summary>
 /// <param name="extensionType">The DAC extension type to act on.</param>
 /// <returns/>
 public static IEnumerable <ITypeSymbol> GetDacExtensionWithBaseTypes(this ITypeSymbol extensionType) =>
 extensionType.CheckIfNull(nameof(extensionType))
 .GetBaseTypesAndThis()
 .TakeWhile(type => !type.IsDacExtensionBaseType());
 /// <summary>
 /// Gets the DAC type with its base types up to the <see cref="System.Object"/>.
 /// </summary>
 /// <param name="dacType">The DAC type to act on.</param>
 /// <returns/>
 public static IEnumerable <ITypeSymbol> GetDacWithBaseTypes(this ITypeSymbol dacType) =>
 dacType.CheckIfNull(nameof(dacType))
 .GetBaseTypesAndThis()
 .TakeWhile(type => !type.IsDacBaseType());
Beispiel #4
0
 public static bool IsDacExtension(this ITypeSymbol typeSymbol, PXContext pxContext) =>
 typeSymbol.CheckIfNull(nameof(typeSymbol))
 .InheritsFrom(pxContext.PXCacheExtensionType);