Why would you replace a component instead of using the other value in the first place?

What do you mean by "the service is not available anymore"?

K

On 22/02/2011 11:17 AM, Belvasis wrote:
I remove the component from the container for instance if i have to register a different implementation or configuration for a service during runtime or the service is not available anymore etc. and i thought remove/register would be an easy way to do that. In the current case i'm just a little confused because it ever worked without any problem, even with the current code. In the moment i call RemoveComponent, there is no other component that depends on it. But maybe i just can't see it. Anyway,i think in this case i can avoid the use of RemoveComponent by using a factory method instead.



2011/2/22 Krzysztof Koźmic <[email protected] <mailto:[email protected]>>

    That's how it works. RemoveComponent will only remove the
    component when it's safe to do so, i.e. no other component depends
    on it.

    Why are you removing the component from the container?

    I'm asking because I want to remove that functionality from the
    container altogether i.e. not allow to remove components once they
    are registered.




    On 22/02/2011 9:52 AM, belvasis.de
    <http://belvasis.de>@googlemail.com <http://googlemail.com> wrote:

        Hi,

        i have a behaviour that is very strange. I use the following
        to Remove a registration from the
        Container:

        if (m_pContainer.Kernel.HasComponent(i_strKey))
        {
        m_pContainer.Kernel.RemoveComponent(i_strKey);
        }

        This works in most cases. But sometimes HasComponent is true
        for the given i_strKey and i
        can see the component when inspecting the Kernel. After the
        call to RemoveComponent,
        the result is still the same...the component with the i_strKey
        name is sill there. So the next time
        i want to register a component with the i_strKey name, an
        exception is thrown.
        Has anyone an idea why this happens and what i can do?

        Thanks and Regards

        B --
        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]
        <mailto:[email protected]>.
        To unsubscribe from this group, send email to
        [email protected]
        <mailto:castle-project-users%[email protected]>.
        For more options, visit this group at
        http://groups.google.com/group/castle-project-users?hl=en.


-- 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]
    <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:castle-project-users%[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/castle-project-users?hl=en.


--
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.

--
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