Ejemplo n.º 1
0
        public ServiceResultDto ServiceMethod01 <ServiceDto>(ServiceDto dto)
        {
            ServiceResultDto resultDto = ServiceBase(
                e =>
            {
                int id = e.Id;
                return(new ServiceResultDto());
            },
                e =>
            {
                int id = e.Id;
                return(new ServiceResultDto());
            },
                e =>
            {
                int id = e.Id;
                return(new ServiceResultDto());
            });

            return(resultDto);
        }
Ejemplo n.º 2
0
        public ServiceResultDto ServiceBase(
            Func <ServiceDto, ServiceResultDto> init,
            Func <ServiceDto, ServiceResultDto> validation,
            Func <ServiceDto, ServiceResultDto> process)
        {
            ServiceResultDto resultDto = new ServiceResultDto();
            ServiceDto       dto       = new ServiceDto();

            try
            {
                // Init-Vorbereitung
                resultDto = init(dto);
                // Init-Nachbereitung
            }
            catch (Exception)
            { }

            try
            {
                // Validation-Vorbereitung
                resultDto = validation(dto);
                // Validation-Nachbereitung
            }
            catch (Exception)
            { }

            try
            {
                // Process-Vorbereitung
                resultDto = process(dto);
                // Process-Nachbereitung
            }
            catch (Exception)
            { }

            return(resultDto);
        }