We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example (from https://github.com/Yeah69/DryIoc.Playground/blob/main/DryIoc.Playground/Case3.cs):
namespace DryIoc.Playground; public static class Case3 { public static void Do() { var container = new Container(); container.RegisterInstance(0); container.Register<DependencyA>(); container.Register<DependencyB>(); container.Register<Parent>(); var parent = container.Resolve<Parent>(); Console.WriteLine(parent.Dependency.Value); // 0 Console.WriteLine(parent.Dependency.Dependency.Value); // 23 Console.WriteLine(parent.Dependency.Dependency.Parent.Dependency.Value); // 23 --> BUT EXPECTING 0 } internal class DependencyA { public int Value { get; } public DependencyB Dependency { get; } public DependencyA( int value, Func<int, DependencyB> dependencyB) { Value = value; Dependency = dependencyB(23); } } internal class DependencyB { private readonly Lazy<Parent> _parentFactory; public int Value { get; } public Parent Parent => _parentFactory.Value; public DependencyB( int value, Lazy<Parent> parentFactory) { _parentFactory = parentFactory; Value = value; } } internal class Parent { public DependencyA Dependency { get; } public Parent( DependencyA dependencyA) => Dependency = dependencyA; } }
The text was updated successfully, but these errors were encountered:
added test for #514
d09bb26
dadhi
No branches or pull requests
Example (from https://github.com/Yeah69/DryIoc.Playground/blob/main/DryIoc.Playground/Case3.cs):
The text was updated successfully, but these errors were encountered: