Just wondering if anyone had this scenario with Unity(as an IoC container) where the class has two injected dependencies(interfaces) where one dependency can be null. For example:
public MyServiceDll(IRepository repository, ICanBeNullDependency canBeNullDependency = null)
{
_repository = repository;
_canBeNullDependency = canBeNullDependency;
}
ICanBeNullDependency is from another assembly. MyServiceDll is another assembly. MyServiceDll is referenced by web api and injected its interface in one of the controllers. ICanBeNullDependency can be null so I don't need to register an implementation of this interface in unityconfig.cs but when the controller gets called it will error saying:
The current type, ICanBeNullDependency, is an interface and cannot be constructed. Are you missing a type mapping?