Skip to content

Commit d4c8cf3

Browse files
committed
adding option for #498
1 parent a4b5b6b commit d4c8cf3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/DryIoc/Container.cs

+10
Original file line numberDiff line numberDiff line change
@@ -6091,6 +6091,15 @@ public Rules WithVariantGenericTypesInResolve() =>
60916091
public Rules WithoutVariantGenericTypesInResolve() =>
60926092
WithSettings(_settings & ~Settings.VariantGenericTypesInResolve);
60936093

6094+
/// <summary>If the dependency factory is not found (including the dynamic factories) generate the `Resolve` call for it,
6095+
/// so it may be resolved from the compile-time registrations</summary>
6096+
public Rules WithGenerateResolutionCallForMissingDependency() =>
6097+
WithSettings(_settings | Settings.GenerateResolutionCallForMissingDependency);
6098+
6099+
/// <summary>Switch off the <see ref="WithGenerateResolutionCallForMissingDependency"/>/summary>
6100+
public Rules WithoutGenerateResolutionCallForMissingDependency() =>
6101+
WithSettings(_settings & ~Settings.GenerateResolutionCallForMissingDependency);
6102+
60946103
/// <summary><see cref="WithDefaultIfAlreadyRegistered"/>.</summary>
60956104
public IfAlreadyRegistered DefaultIfAlreadyRegistered { get; private set; }
60966105

@@ -6293,6 +6302,7 @@ private enum Settings
62936302
ServiceProviderGetServiceShouldThrowIfUnresolved = 1 << 22,
62946303
ThrowIfScopedOrSingletonHasTransientDependency = 1 << 23,
62956304
VariantGenericTypesInResolve = 1 << 24,
6305+
GenerateResolutionCallForMissingDependency = 1 << 25,
62966306
}
62976307

62986308
private const Settings DEFAULT_SETTINGS

0 commit comments

Comments
 (0)