using Volo.Abp.EventBus.Local;
namespace JiShe.IoT
{
public abstract class IoTDomainService : DomainService
{
protected Type ObjectMapperContext { get; set; }
///
/// 工作单元管理器
///
protected IUnitOfWorkManager UnitOfWorkManager =>
LazyServiceProvider.LazyGetRequiredService();
///
/// 领域事件总线
///
protected ILocalEventBus LocalEventBus =>
LazyServiceProvider.LazyGetRequiredService();
///
/// 分布式事件总线
///
protected IDistributedEventBus DistributedEventBus =>
LazyServiceProvider.LazyGetRequiredService();
///
/// 对象映射器
///
protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(
provider =>
ObjectMapperContext == null
? provider.GetRequiredService()
: (IObjectMapper)provider.GetRequiredService(
typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext)));
}
}