51 references to OutLn
Microsoft.Extensions.Options.SourceGeneration (51)
Emitter.cs (48)
106OutLn($"namespace {vt.Namespace}");
112OutLn(p);
119OutLn($"internal sealed partial {vt.DeclarationKeyword} {vt.Name}");
123OutLn($"partial {vt.DeclarationKeyword} {vt.Name}");
150OutLn($"namespace {classNamespace}");
154OutLn($"{_optionsSourceGenContext.ClassModifier} static class {className}");
200OutLn($$"""
247OutLn($$"""
293OutLn($$"""
343OutLn($$"""
454OutLn($$"""
622OutLn($"namespace {StaticGeneratedValidationAttributesClassesNamespace}");
660OutLn($"context.MemberName = \"Validate\";");
661OutLn($"context.DisplayName = string.IsNullOrEmpty(name) ? \"{modelName}.Validate\" : $\"{{name}}.Validate\";");
662OutLn($"(builder ??= new()).AddResults(((global::System.ComponentModel.DataAnnotations.IValidatableObject)options).Validate(context));");
673OutLn($"/// <summary>");
674OutLn($"/// Validates a specific named options instance (or all when <paramref name=\"name\"/> is <see langword=\"null\" />).");
675OutLn($"/// </summary>");
676OutLn($"/// <param name=\"name\">The name of the options instance being validated.</param>");
677OutLn($"/// <param name=\"options\">The options instance.</param>");
678OutLn($"/// <returns>Validation result.</returns>");
685OutLn($"[System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage(\"Trimming\", \"IL2026:RequiresUnreferencedCode\",");
686OutLn($" Justification = \"The created ValidationContext object is used in a way that never call reflection\")]");
689OutLn($"public {(makeStatic ? "static " : string.Empty)}global::Microsoft.Extensions.Options.ValidateOptionsResult Validate(string? name, {modelToValidate.Name} options)");
691OutLn($"global::Microsoft.Extensions.Options.ValidateOptionsResultBuilder? builder = null;");
692OutLn($"var context = new {StaticValidationContextType}(options);");
697OutLn($"var validationResults = new {StaticListType}<{StaticValidationResultType}>();");
698OutLn($"var validationAttributes = new {StaticListType}<{StaticValidationAttributeType}>({capacity});");
726OutLn($"return builder is null ? global::Microsoft.Extensions.Options.ValidateOptionsResult.Success : builder.Build();");
732OutLn($"context.MemberName = \"{vm.Name}\";");
733OutLn($"context.DisplayName = string.IsNullOrEmpty(name) ? \"{modelName}.{vm.Name}\" : $\"{{name}}.{vm.Name}\";");
737OutLn($"validationResults.Clear();");
738OutLn($"validationAttributes.Clear();");
744OutLn($"validationAttributes.Add({_staticValidationAttributeHolderClassFQN}.{staticValidationAttributeInstance.FieldName});");
747OutLn($"if (!global::System.ComponentModel.DataAnnotations.Validator.TryValidateValue(options.{vm.Name}{_TryGetValueNullableAnnotation}, context, validationResults, validationAttributes))");
749OutLn($"(builder ??= new()).AddResults(validationResults);");
833OutLn($"if (options.{vm.Name} is not null)");
835OutLn($"(builder ??= new()).AddResult({callSequence}.Validate({baseName}, options.{vm.Name}{valueAccess}));");
840OutLn($"(builder ??= new()).AddResult({callSequence}.Validate({baseName}, options.{vm.Name}{valueAccess}));");
862OutLn($"if (options.{vm.Name} is not null)");
867OutLn($"var count = 0;");
868OutLn($"foreach (var o in options.{vm.Name}{valueAccess})");
873OutLn($"if (o is not null)");
876OutLn($"(builder ??= new()).AddResult({callSequence}.Validate({propertyName}, o{enumeratedValueAccess}));");
881OutLn($"else");
884OutLn($"(builder ??= new()).AddError({error});");
888OutLn($"count++;");
893OutLn($"(builder ??= new()).AddResult({callSequence}.Validate({propertyName}, o{enumeratedValueAccess}));");