Is it possible to update registered singleton using unity container, c#?

Viewed 34

I'm using unity container to implement a singleton design.

This is my code:

public class ExampleClass
{
   public MyObj obj {get;private set;}
}

creating the singleton :

container.RegistryInstance(new ExampleClass());

get the singleton:

container.Resolve<ExampleClass>();

I'd like to update the obj object and to keep on the singleton object,

How can I update the singleton object?

I tried like this(this is not right):

container.Resolve<ExampleClass>(new new ExampleClass());
0 Answers
Related