public virtual async Task <AggregateReRouteDto> UpdateAsync(AggregateReRouteUpdateDto input)
        {
            var routeId        = long.Parse(input.RouteId);
            var aggregateRoute = await _aggregateReRouteRepository.GetByRouteIdAsync(routeId);

            aggregateRoute.Priority               = input.Priority;
            aggregateRoute.ConcurrencyStamp       = input.ConcurrencyStamp;
            aggregateRoute.ReRouteIsCaseSensitive = input.ReRouteIsCaseSensitive;
            aggregateRoute.Aggregator             = input.Aggregator;
            aggregateRoute.SetUpstream(input.UpstreamHost, input.UpstreamPathTemplate);

            aggregateRoute.RemoveAllUpstreamHttpMethod();
            foreach (var httpMethod in input.UpstreamHttpMethod)
            {
                aggregateRoute.AddUpstreamHttpMethod(httpMethod);
            }

            aggregateRoute.RemoveAllRouteKey();
            foreach (var routeKey in input.ReRouteKeys)
            {
                aggregateRoute.AddRouteKey(routeKey);
            }

            aggregateRoute = await _aggregateReRouteRepository.UpdateAsync(aggregateRoute, true);

            await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "Update"));

            return(ObjectMapper.Map <AggregateReRoute, AggregateReRouteDto>(aggregateRoute));
        }
예제 #2
0
        public virtual async Task <AggregateReRouteDto> UpdateAsync(AggregateReRouteUpdateDto aggregateReRouteUpdate)
        {
            var routeId        = long.Parse(aggregateReRouteUpdate.RouteId);
            var aggregateRoute = await _aggregateReRouteRepository.GetByRouteIdAsync(routeId);

            aggregateRoute.Priority               = aggregateReRouteUpdate.Priority;
            aggregateRoute.ConcurrencyStamp       = aggregateReRouteUpdate.ConcurrencyStamp;
            aggregateRoute.ReRouteIsCaseSensitive = aggregateReRouteUpdate.ReRouteIsCaseSensitive;
            aggregateRoute.Aggregator             = aggregateReRouteUpdate.Aggregator;
            aggregateRoute.SetUpstream(aggregateReRouteUpdate.UpstreamHost, aggregateReRouteUpdate.UpstreamPathTemplate);

            aggregateRoute.RemoveAllUpstreamHttpMethod();
            foreach (var httpMethod in aggregateReRouteUpdate.UpstreamHttpMethod)
            {
                aggregateRoute.AddUpstreamHttpMethod(httpMethod);
            }

            aggregateRoute.RemoveAllRouteKey();
            foreach (var routeKey in aggregateReRouteUpdate.ReRouteKeys)
            {
                aggregateRoute.AddRouteKey(routeKey);
            }

            aggregateRoute = await _aggregateReRouteRepository.UpdateAsync(aggregateRoute, true);

            await _eventPublisher.PublishAsync(ApigatewayConfigChangeCommand.EventName,
                                               new ApigatewayConfigChangeCommand("AggregateRoute", "Update"));

            return(ObjectMapper.Map <AggregateReRoute, AggregateReRouteDto>(aggregateRoute));
        }
예제 #3
0
 public async Task <AggregateReRouteDto> UpdateAsync(AggregateReRouteUpdateDto aggregateReRouteUpdate)
 {
     return(await AggregateReRouteAppService.UpdateAsync(aggregateReRouteUpdate));
 }