1

I want use DryIoc container in web form, I use sample code : https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/ReuseAndScopes.md#reuse-and-scopes But every time I ask, I get a new instance from the container :

 var container = new Container(rules => rules.WithDefaultReuse(Reuse.Scoped));
            container.Register<ScopeService>();

            _serviceContainer = container;

            using (var scope = container.OpenScope())
            {
                var oSingleton = scope.Resolve<ScopeService>();
                Debug.WriteLine($"APPLICION SINGLETON : {oSingleton.ID}");

                var oSingleton2 = scope.Resolve<ScopeService>();
                Debug.WriteLine($"APPLICION SINGLETON2 : {oSingleton2.ID}");
            }

I describe my service in Singleton reuse, But I get a new instance from the container

MrMohande3
  • 11
  • 2
  • I checked on the latest DryIoc v5.3.4 and your example works just fine resolving the same instances. – dadhi Apr 17 '23 at 12:36

0 Answers0