プロパティ/フィールド インジェクション
If the object has a local default and Inject is optional, Property/Field Injection can be used.
class ClassA
{
[Inject]
IServiceA serviceA { get; set; } // Will be overwritten if something is registered.
public ClassA()
{
serviceA = ServiceA.GoodLocalDefault;
}
}
It can resolve like this:
[Inject]
IServiceA serviceA;