Beispiel #1
0
 /// <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;
 }
Beispiel #2
0
 /// <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;
 }
Beispiel #3
0
        /// <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);
                });
            }
        }
Beispiel #4
0
        /// <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;
        }
Beispiel #5
0
        /// <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);
                                                            });
            }
        }
Beispiel #6
0
 /// <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;
 }
Beispiel #9
0
 public GeneralInfoService(IServiceInfoRepository serviceInfoRepository, IMapper mapper, IFileRepository fileRepository)
 {
     _serviceInfoRepository = serviceInfoRepository;
     _mapper         = mapper;
     _fileRepository = fileRepository;
 }
Beispiel #10
0
 /// <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
         }
     });
 }
Beispiel #11
0
        /// <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);
        }