Unity and WCF .. resolving same instance

Dec 8, 2009 at 1:45 AM

Hi
I am using UnityContainer with WCF. I have a problem with resolving instances.

I have IUnitOfWork registered[ perthreadlifetime manager]
When resolving iUnitOfWork, I create an instance of ObjectContext. I register the instance [calling registerInstance and again PerthreadLifeTimeManager]

I register the instance here, because I have several other modules that are dependent on this instance.

So for every WCF method call, I resolve IUnitOfWork which should create a new ObjeectContext. I perform the operation and then dispose the UnitOfWork which disposes the ObjectContext

It works great for the first call. For subsequent calls, it tries to resolve the same ObjectContext for some reason. I was hoping it to resolve a new instance of the context. I am not sure what the problem is.
Help really appreciated.