static void PrintTrait(CdmTraitReferenceBase trait) { if (!string.IsNullOrEmpty(trait.FetchObjectDefinitionName())) { Console.WriteLine(" " + trait.FetchObjectDefinitionName()); if (trait is CdmTraitReference) { foreach (var argDef in (trait as CdmTraitReference).Arguments) { if (argDef.Value is CdmEntityReference) { Console.WriteLine(" Constant: ["); var contEntDef = argDef.Value.FetchObjectDefinition <CdmConstantEntityDefinition>(); foreach (List <string> constantValueList in contEntDef.ConstantValues) { Console.WriteLine($" [{String.Join(", ", constantValueList.ToArray())}]"); } Console.WriteLine(" ]"); } else { // Default output, nothing fancy for now Console.WriteLine(" " + argDef.Value); } } } } }
private static bool ShouldPersistTrait(CdmTraitReferenceBase traitBase) { if (!(traitBase is CdmTraitReference trait)) { return(true); } switch (trait.NamedReference) { case "is.partition.format.CSV": var argumentNames = new HashSet <string>(trait.Arguments.AllItems.Where(arg => arg.Name != null).Select(arg => arg.Name)); // Checks if the trait contains arguments that are not supported natively by the model.json CsvFormatSettings property. return(argumentNames.Except(PartitionSettingsSupportedArguments).Count() > 0); default: return(true); } }
/// <summary> /// Checks whether a <see cref="CdmTraitReferenceBase"/> is an extension. /// </summary> /// <param name="trait">The trait to be checked whether it is an extension.</param> /// <returns>Whether the trait is an extension.</returns> public static bool TraitRefIsExtension(CdmTraitReferenceBase trait) { return(TraitNameHasExtensionMark(trait.NamedReference)); }