Hi,

I have a situation where i want to register an existing instance of a
service with a specific key.Beside this
i need the serviceregistration that gives me a new instance everytime i call
Resolve<>().
So i did the following:

      IService pS1 = new TestService();

      pContainer.Register(
Component.For<IService>().Instance(pS1).Named("sinst") );
      pContainer.Register(
Component.For<IService>().ImplementedBy<TestService>().LifeStyle.Transient
);

      IService pS2 = pContainer.Resolve<IService>("sinst");
      IService pS3 = pContainer.Resolve<IService>();

      Assert.AreEqual(pS1, pS2);
      Assert.AreNotEqual(pS2, pS3);

This test fails, because pS2 and pS3 are the same instance. Is this the
correct behaviour? How can i
solve this?

Thanks

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