您能否就如何将一些引用传递给其他注册提供一些指导?
//registration of 1st http client
builder.RegisterType<HttpClient>()
//.Keyed<HttpMessageInvoker>("authHttpClient")
.WithProperties(new[] { new NamedPropertyParameter("PooledConnectionLifetime", 2 })
.WithProperties(new[] { new NamedPropertyParameter("BaseAddress", "whatever"))})
.SingleInstance();
//registration of 2nd httpclient
builder.RegisterType<HttpClient>()
.Keyed<HttpMessageInvoker>("dynamicsHttpClient")
.WithProperties(new[] { new NamedPropertyParameter("PooledConnectionLifetime", 20) })
.WithProperties(new[] { new NamedPropertyParameter("BaseAddress", "other something" })
.SingleInstance();
// **I need to do the registration of type and pass the 1st httpClient registration**
builder.RegisterType<DynamicsAuthApiGateway>()
.As<IDynamicsAuthApiGateway>()
// **I need to do the registration of type pass 2nd instance of httpClient registration**
builder.RegisterType<DynamicsApiGateway>()
.As<IDynamicsApiGateway>()
.SingleInstance();
//Method ctor's
//DynamicsAuthApiGateway(**HttpClient client**, DynamicsAuthApiGatewaySettings apiGatewaySettings)
//DynamicsApiGateway(**HttpClient client**, Func<HttpResponseMessage, Task> errorHandler = null)
你能帮助实现这一目标吗?
任何帮助,将不胜感激 ?
谢谢,我