/// <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> /// 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; }
/// <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 } }; }