Thanks for the reply. I went down the Container way. I would prefer not to use the copy code method but in reality, all I am after is the weak dictionary.
The code I am using is below:
_container.RegisterInstance<T>(key, value, new ExternallyControlledLifetimeManager());
Now the only functionality I am missing is the Remove
_container.RemoveInstance<T>(key, value, new ExternallyControlledLifetimeManager());
In reading the other discussions, it looks like this is intentionally left out. So my question is what is the work around.
Basically what I am doing is storing weak references to my Entities for EntityTracking. Once something is Deleted from the Database, I am wanting to remove that reference. I want _container.Resolve<T>(key) to return null.
I was thinking I could hack this by calling _container.RegisterInstance<T>(key, null, new Externally...));
What are your thoughts?
Thanks for the help!