Update an already injected service DryIoc c#
Hi I have a situation where I need to update a service that I have injected.
When I first launch the app I have something like
public class MyService:IMyService
{
public string ValueAPopulatedBeforeLogin { get; set; }
public string ValueBPopulatedBeforeLogin { get; set; }
public string ValueCPopulatedAfterLogin { get; set; }
}
container<IMyService,MyService>();
- Start the app
- ValueA and B are populated ValueC IS NOT
- Login now valueC is populated
Now I need to update MyService but doing
container.ClearCache(typeOf(IMyService));
container.UseInstance(MyService); //with new ValueC updated value
however the new property has not been updated.
How do you update an already injected service? Is this possible?
thanks
Comments
Post a Comment