/// <summary> /// Initializes a new instance of the <see cref="ServiceInfoService"/> class. /// </summary> /// <param name="busRepository">The bus repository.</param> /// <param name="serviceRepository">The service repository.</param> public ServiceInfoService( IServiceInfoRepository busRepository, IServiceInfoRepository serviceRepository) { _serviceRepository = serviceRepository; _busRepository = busRepository; }
/// <summary> /// Initializes a new instance of the <see cref="ServiceInfoService"/> class. /// </summary> /// <param name="busRepository">The bus repository.</param> /// <param name="serviceRepository">The service repository.</param> public ServiceInfoService( IServiceInfoRepository busRepository, IServiceInfoRepository serviceRepository) { _serviceRepository = serviceRepository; _busRepository = busRepository; }
/// <summary> /// Saves the heartBeatEntity. /// </summary> /// <param name="serviceInfoEntity">The service info heartBeatEntity.</param> /// <param name="repository">The repository.</param> /// <param name="updateAction">The update action.</param> private static void Save( ServiceInfoEntity serviceInfoEntity, IServiceInfoRepository repository, Action <IModifierExpression <ServiceInfoEntity, ObjectId> > updateAction) { if (serviceInfoEntity == null) { return; } if (serviceInfoEntity.Id == ObjectId.Empty) { repository.Save(serviceInfoEntity); } else { repository.Update(serviceInfoEntity.Id, bd => { updateAction(bd); SetValueMonitoring(bd, serviceInfoEntity); }); } }
/// <summary> /// Gets the service info. /// </summary> /// <param name="serviceIdentification">The service info heartBeatEntity.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private ServiceInfoEntity GetServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { var infoEntity = repository.FindOne(new {Identification = new {serviceIdentification.Id, serviceIdentification.Type}}); if (infoEntity == null) { InvokeServiceNotExist(new ServiceInfoEventHandlerArgs()); } return infoEntity; }
/// <summary> /// Saves the heartBeatEntity. /// </summary> /// <param name="serviceInfoEntity">The service info heartBeatEntity.</param> /// <param name="repository">The repository.</param> /// <param name="updateAction">The update action.</param> private static void Save( ServiceInfoEntity serviceInfoEntity, IServiceInfoRepository repository, Action<IModifierExpression<ServiceInfoEntity, ObjectId>> updateAction) { if (serviceInfoEntity == null) return; if (serviceInfoEntity.Id == ObjectId.Empty) repository.Save(serviceInfoEntity); else { repository.Update(serviceInfoEntity.Id, bd => { updateAction(bd); SetValueMonitoring(bd, serviceInfoEntity); }); } }
/// <summary> /// Gets the or create service info. /// </summary> /// <param name="serviceIdentification">The service identification.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private static ServiceInfoEntity GetOrCreateServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { return repository.FindOne(new { Identification = new { serviceIdentification.Id, serviceIdentification.Type } }) ?? new ServiceInfoEntity { Identification = new Identification { Id = serviceIdentification.Id, Type = serviceIdentification.Type } }; }
public ServiceInfoService(IServiceInfoRepository serviceInfoRepository) { this.ServiceInfoRepository = serviceInfoRepository; }
public ServiceInfoService(IServiceInfoRepository serviceInfoRepository, ILogger logger) { _serviceInfoRepository = serviceInfoRepository; _logger = logger; }
public GeneralInfoService(IServiceInfoRepository serviceInfoRepository, IMapper mapper, IFileRepository fileRepository) { _serviceInfoRepository = serviceInfoRepository; _mapper = mapper; _fileRepository = fileRepository; }
/// <summary> /// Gets the or create service info. /// </summary> /// <param name="serviceIdentification">The service identification.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private static ServiceInfoEntity GetOrCreateServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { return(repository.FindOne(new { Identification = new { serviceIdentification.Id, serviceIdentification.Type } }) ?? new ServiceInfoEntity { Identification = new Identification { Id = serviceIdentification.Id, Type = serviceIdentification.Type } }); }
/// <summary> /// Gets the service info. /// </summary> /// <param name="serviceIdentification">The service info heartBeatEntity.</param> /// <param name="repository">The repository.</param> /// <returns></returns> private ServiceInfoEntity GetServiceInfo(Identification serviceIdentification, IServiceInfoRepository repository) { var infoEntity = repository.FindOne(new { Identification = new { serviceIdentification.Id, serviceIdentification.Type } }); if (infoEntity == null) { InvokeServiceNotExist(new ServiceInfoEventHandlerArgs()); } return(infoEntity); }