Hi

I might have misunderstood the purpose or overlooked some limitations
of the new BoundTo lifestyle, but isn't this supposed to work?

    public class windsor_boundto_scoping
    {
        [Fact]
        public void can_scope_late_bound()
        {
            var c = new WindsorContainer()
                .AddFacility<TypedFactoryFacility>()
                .Register(Component.For<Parent>().LifeStyle.Transient,
 
Component.For<Child>().LifeStyle.BoundTo<Parent>());

            c.Resolve<Parent>().AndThen();
        }

        public class Parent
        {
            readonly Func<Child> late;

            public Parent(Func<Child> late)
            {
                this.late = late;
            }

            public void AndThen()
            {
                late();
            }
        }

        public class Child
        {
        }
    }

The docs says: "Bound lifestyle - allows objects to be reused within
dependency subtree"

Is a typed factory not part of the dependency subtree of its owner?

//Asger

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to