예제 #1
0
        public void Insert(InsertExposerDto dto)
        {
            Service servie  = _serviceRepository.Get(dto.ServiceId);
            Exposer exposer = new Exposer(dto.Name, dto.Path, servie);

            _exposerRepository.Insert(exposer);
        }
예제 #2
0
        public void UpdateExposer(ExposerDto dto)
        {
            Exposer exposer = _exposerRepository.Get(dto.Id);

            exposer.Name = dto.Name;
            exposer.Path = dto.Path;

            _exposerRepository.Update(exposer);
        }
예제 #3
0
        public static ExposerDto ToDto(this Exposer entity)
        {
            if (entity == null)
            {
                return(null);
            }

            ExposerDto dto = new ExposerDto();

            dto.Id   = entity.Id;
            dto.Name = entity.Name;
            dto.Path = entity.Path;

            return(dto);
        }
예제 #4
0
        public ExposerResultDto ExecuteExposer(ExecuteExposerDto dto)
        {
            Exposer exposer = _exposerRepository.GetByPath(dto.Path);

            if (exposer == null)
            {
                throw new ExposerDoesNotExistException();
            }

            IList <Header> headers = new List <Header>();

            foreach (var h in dto.Headers)
            {
                headers.Add(new Header(h.Name, h.Value));
            }

            switch (exposer.Service.ServiceType)
            {
            case ServiceType.DUMMY:
                return(null);

            case ServiceType.REST:
                RestService         restService = _jsonSerializer.Deserialize <RestService>(exposer.Service.JsonDetails);
                RestServiceRequest  request     = new RestServiceRequest(restService, dto.HttpMethod, headers, dto.RequestBody);
                RestServiceResponse response    = _restServiceExecutor.Execute(request);

                return(response.ToDto());

            case ServiceType.SOAP:
                return(null);

            case ServiceType.DATABASE:
                return(null);

            default:
                return(null);
            }
        }
예제 #5
0
        public ExposerDto GetExposerById(ExposerIdDto dto)
        {
            Exposer exposer = _exposerRepository.Get(dto.Id);

            return(exposer.ToDto());
        }
예제 #6
0
 public static dynamic ExposeStatics(this Type target)
 {
     return(Exposer.ExposeStatics(target));
 }
예제 #7
0
 public static dynamic Expose(this object target)
 {
     return(Exposer.Expose(target));
 }