Пример #1
0
        /// <summary>
        /// 服务移除
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <DeleteServiceOutput> DeleteService(DeleteServiceInput input)
        {
            await _serviceDiscovery.DeregisterServiceAsync(input.ServiceId);

            return(new DeleteServiceOutput {
            });
        }
        public async Task <BaseOutput> DeleteService([FromBody] DeleteServiceInput input)
        {
            await _serviceDiscovery.DeregisterServiceAsync(input.ServiceId);

            return(new BaseOutput {
            });
        }
Пример #3
0
        public async Task <ServiceBasePayload> DeleteService(DeleteServiceInput input,
                                                             [ScopedService] ApplicationDbContext context, CancellationToken cancellationToken)
        {
            var service = await context.Service
                          .IncludeOptimized(x => x.Maintenance)
                          .DeferredFirst(x => x.Id == input.ServiceId).FromCacheAsync(cancellationToken);

            await context.Incident.Where(x => x.Service == service).DeleteAsync(cancellationToken: cancellationToken);

            await context.Service.Where(x => x.Parent == service).DeleteAsync(cancellationToken: cancellationToken);

            await context.Monitor.Where(x => x.Service == service).DeleteAsync(cancellationToken: cancellationToken);

            context.Remove(service);
            await context.BulkSaveChangesAsync(cancellationToken);

            QueryCacheManager.ExpireType <Service>();
            return(new ServiceBasePayload(service));
        }
Пример #4
0
 public async Task <DeleteServiceOutput> DeleteService([FromBody] DeleteServiceInput input)
 {
     return(await _microserviceBusines.DeleteService(input));
 }