40 references to MethodsToGen_CoreBindingHelper
Microsoft.Extensions.Configuration.Binder.SourceGeneration (40)
Emitter\ConfigurationBinder.cs (3)
29
const string expressionForGetCore = nameof(
MethodsToGen_CoreBindingHelper
.GetCore);
63
const string expressionForGetValueCore = $"{Identifier.BindingExtensions}.{nameof(
MethodsToGen_CoreBindingHelper
.GetValueCore)}";
161
{{nameof(
MethodsToGen_CoreBindingHelper
.BindCore)}}({{configExpression}}, ref {{Identifier.typedObj}}, defaultValueIfNotFound: false, {{binderOptionsArg}});
Emitter\CoreBindingHelpers.cs (15)
22
private bool ShouldEmitMethods(
MethodsToGen_CoreBindingHelper
methods) => (_bindingHelperInfo.MethodsToGen & methods) != 0;
93
EmitStartBlock($"public static object? {nameof(
MethodsToGen_CoreBindingHelper
.GetCore)}(this {Identifier.IConfiguration} {Identifier.configuration}, Type {Identifier.type}, Action<{Identifier.BinderOptions}>? {Identifier.configureOptions})");
181
EmitStartBlock($"public static object? {nameof(
MethodsToGen_CoreBindingHelper
.GetValueCore)}(this {Identifier.IConfiguration} {Identifier.configuration}, Type {Identifier.type}, string {Identifier.key})");
220
EmitStartBlock($"public static void {nameof(
MethodsToGen_CoreBindingHelper
.BindCoreMain)}({Identifier.IConfiguration} {Identifier.configuration}, object {Identifier.instance}, Type {Identifier.type}, {TypeDisplayString.NullableActionOfBinderOptions} {Identifier.configureOptions})");
263
EmitStartBlock(@$"public static void {nameof(
MethodsToGen_CoreBindingHelper
.BindCore)}({Identifier.IConfiguration} {Identifier.configuration}, {objParameterExpression}, bool defaultValueIfNotFound, {Identifier.BinderOptions}? {Identifier.binderOptions})");
442
bool emitAsConfigWithChildren = ShouldEmitMethods(
MethodsToGen_CoreBindingHelper
.AsConfigWithChildren);
444
if (ShouldEmitMethods(
MethodsToGen_CoreBindingHelper
.BindCore))
450
if (ShouldEmitMethods(
MethodsToGen_CoreBindingHelper
.BindCoreMain |
MethodsToGen_CoreBindingHelper
.GetCore))
464
if (ShouldEmitMethods(
MethodsToGen_CoreBindingHelper
.BindCoreMain |
MethodsToGen_CoreBindingHelper
.GetCore) ||
549
return {{
MethodsToGen_CoreBindingHelper
.AsConfigWithChildren}}({{Identifier.configuration}}) is not null;
557
public static {{Identifier.IConfiguration}}? {{
MethodsToGen_CoreBindingHelper
.AsConfigWithChildren}}({{Identifier.IConfiguration}} {{Identifier.configuration}})
973
string sectionValidationCall = $"{
MethodsToGen_CoreBindingHelper
.AsConfigWithChildren}({configSection})";
1130
string bindCoreCall = $@"{nameof(
MethodsToGen_CoreBindingHelper
.BindCore)}({configArgExpr}, ref {instanceToBindExpr}, defaultValueIfNotFound: {FormatDefaultValueIfNotFound()}, {Identifier.binderOptions});";
Emitter\Helpers.cs (1)
277
$"{nameof(
MethodsToGen_CoreBindingHelper
.Initialize)}{type.IdentifierCompatibleSubstring}";
Emitter\OptionsBuilderConfigurationExtensions.cs (1)
75
{{nameof(
MethodsToGen_CoreBindingHelper
.BindCoreMain)}}({{Identifier.section}}, {{Identifier.instance}}, typeof({{Identifier.TOptions}}), {{Identifier.configureBinder}});
Emitter\OptionsConfigurationServiceCollectionExtensions.cs (1)
61
return {{Identifier.services}}.{{Identifier.AddSingleton}}<IConfigureOptions<{{Identifier.TOptions}}>>(new ConfigureNamedOptions<{{Identifier.TOptions}}>({{Identifier.name}}, {{Identifier.instance}} => {{nameof(
MethodsToGen_CoreBindingHelper
.BindCoreMain)}}({{Identifier.config}}, {{Identifier.instance}}, typeof({{Identifier.TOptions}}), {{Identifier.configureOptions}})));
Specs\BindingHelperInfo.cs (19)
17
public required
MethodsToGen_CoreBindingHelper
MethodsToGen { get; init; }
29
private
MethodsToGen_CoreBindingHelper
_methodsToGen;
32
private readonly Dictionary<
MethodsToGen_CoreBindingHelper
, HashSet<TypeSpec>> _typesForGen = new();
51
TypesForGen_GetCore = GetTypesForGen_CoreBindingHelper<TypeSpec>(
MethodsToGen_CoreBindingHelper
.GetCore),
52
TypesForGen_BindCoreMain = GetTypesForGen_CoreBindingHelper<ComplexTypeSpec>(
MethodsToGen_CoreBindingHelper
.BindCoreMain),
53
TypesForGen_GetValueCore = GetTypesForGen_CoreBindingHelper<TypeSpec>(
MethodsToGen_CoreBindingHelper
.GetValueCore),
54
TypesForGen_BindCore = GetTypesForGen_CoreBindingHelper<ComplexTypeSpec>(
MethodsToGen_CoreBindingHelper
.BindCore),
55
TypesForGen_Initialize = GetTypesForGen_CoreBindingHelper<ObjectSpec>(
MethodsToGen_CoreBindingHelper
.Initialize),
56
TypesForGen_ParsePrimitive = GetTypesForGen_CoreBindingHelper<ParsableFromStringSpec>(
MethodsToGen_CoreBindingHelper
.ParsePrimitive)
59
ImmutableEquatableArray<TSpec>? GetTypesForGen_CoreBindingHelper<TSpec>(
MethodsToGen_CoreBindingHelper
overload)
85
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.GetCore, type);
96
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.GetValueCore, typeSpec);
105
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.BindCoreMain, type);
189
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.Initialize, objectSpec);
209
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.BindCore, type);
217
private void RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
method, TypeSpec type)
234
_methodsToGen |=
MethodsToGen_CoreBindingHelper
.ParsePrimitive;
235
RegisterTypeForMethodGen(
MethodsToGen_CoreBindingHelper
.ParsePrimitive, type);
239
private void RegisterForGen_AsConfigWithChildrenHelper() => _methodsToGen |=
MethodsToGen_CoreBindingHelper
.AsConfigWithChildren;