0

为模型创建服务后,如何告诉模型使用该服务?

在示例 Tesla 应用程序中,存在调用服务作为参数的构造函数:

private readonly IClimateService _service;

public ClimateModel(IExrinContainer exrinContainer, IAuthModel authModel, IClimateService service)
        : base(exrinContainer, new ClimateModelState())
    { _service = service; }

我搜索但从未找到模型接收服务的位置,但我确实找到了这个:

protected override void InitServices()
{
    RegisterTypeAssembly(typeof(IService), new AssemblyName(nameof(TeslaService)));
        base.InitServices();
}
4

1 回答 1

1

Exrin 通过反射自动加载服务,如果它们继承自

Exrin.Abstraction.IService
于 2017-06-06T09:15:27.450 回答