Closed isaacrlevin closed 4 years ago
Which dependency injection framework are you using? Most have support for constructor parameters. For example in asp.net core:
services.AddTransient<ILocalHueClient>(s => new LocalHueClient(ip));
I'm using ASP.NET Core but the issue I see is what do I do if the IP is determined at runtime?
You can create another service / factory that creates the HueClient and use that with your DI container?
Example (you might want to store the returned hue client):
public class HueClientFactory : IHueClientFactory
{
public ILocalHueClient GetClient(string ip)
{
return new LocalHueClient(ip);
}
}
Hello,
I am using this to build out a .NET Core project and I am unable to wire up DI for
LocalHueClient
due to a missing default constructor for it. Is there any opportunity to add this?