OnCreateActionDelegate<T> breaking change. Can't fix it.

15 views
Skip to first unread message

mynkow

unread,
Jan 12, 2012, 9:41:10 AM1/12/12
to castle-pro...@googlegroups.com
I have several components which do some extra work when they are created. This extra work is related to the windsor container. The new Action<T> delegate for the method OnCreate(...) does not provide kernel parameter. UsingFactoryMethod is not an option because I have other problems there.

Krzysztof Koźmic

unread,
Jan 12, 2012, 3:46:59 PM1/12/12
to castle-pro...@googlegroups.com
Which OnCreate do you mean?
You can still do this:
            Container.Register(Component.For<IFoo>().ImplementedBy<Foo>()
                                   .OnCreate((kernel, instance) => {/*something*/}));

And the Action overload is for convenience if you don't care about the kernel.

K

On 13/01/2012 12:41 AM, mynkow wrote:
I have several components which do some extra work when they are created. This extra work is related to the windsor container. The new Action<T> delegate for the method OnCreate(...) does not provide kernel parameter. UsingFactoryMethod is not an option because I have other problems there. --
You received this message because you are subscribed to the Google Groups "Castle Project Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/castle-project-users/-/L0070VBACqAJ.
To post to this group, send email to castle-pro...@googlegroups.com.
To unsubscribe from this group, send email to castle-project-u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.

mynkow

unread,
Jan 12, 2012, 3:57:31 PM1/12/12
to castle-pro...@googlegroups.com
I do not get it. The overloads I see here do not have delegate with 2 parameters.

        public ComponentRegistration<TService> OnCreate(params Action<TService>[] actions);
        public ComponentRegistration<TService> OnCreate(params LifecycleActionDelegate<TService>[] actions);

Ok, thank you very much. 

Krzysztof Koźmic

unread,
Jan 12, 2012, 3:59:57 PM1/12/12
to castle-pro...@googlegroups.com
public delegate void LifecycleActionDelegate<T>(IKernel kernel, T item);

> --
> You received this message because you are subscribed to the Google
> Groups "Castle Project Users" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/castle-project-users/-/4HjQF8TRS7cJ.

Reply all
Reply to author
Forward
0 new messages