I have the following interface and its implementation
public class DummyProxy : IDummyProxy
{
public string SessionID { get; set; }
public DummyProxy(string sessionId)
{
SessionId = sessionId;
}
}
public interface IDummyProxy
{
}
Then I have another class to get a session id
public class DummySession
{
public string GetSessionId()
{
Random random = new Random();
return random.Next(0, 100).ToString();
}
}
Now, in my Unity container, I would like to inject 'session id' to DummyProxy every time the container is trying to resolve IDummyProxy. But this 'session id' must be generated from DummySession class.
container.RegisterType<IDummyProxy, DummyProxy>(
new InjectionConstructor(new DummySession().GetSessionId()));
Is this even possible?