Reputation: 35213
I would like consumers of my nuget package to be able to inject an optional IConfiguration
implementation. I'm using it along with Umbraco, so it's wired up automatically with Lightinject 5.4.
I've created a property with the optional config:
[Inject]
public IConfiguration OptionalInjectedConfiguration { get; set; }
The docs state:
Note:* LightInject considers all read/write properties a dependency, but implements a loose strategy around property dependencies, meaning that it will NOT* throw an exception in the case of an unresolved property dependency.
Yet it throws Unresolved dependency
for the property. How should I pass this optional dependency?
Upvotes: 2
Views: 156