Ejemplo n.º 1
0
        public ServerProcessingResult Execute(ServerCommandInfo[] commands)
        {
            var stopwatch = Stopwatch.StartNew();

            var result = ExecuteInner(commands);

            _performanceLogger.Write(stopwatch, "RhetosService: Executed " + string.Join(",", commands.Select(c => c.CommandName)) + ".");

            return result;
        }
Ejemplo n.º 2
0
        public ServerProcessingResult Execute(ServerCommandInfo[] commands)
        {
            var stopwatch = Stopwatch.StartNew();

            var serverCallID = Guid.NewGuid();
            _commandsLogger.Trace(() => XmlUtility.SerializeServerCallInfoToXml(commands, serverCallID));

            var result = ExecuteInner(commands);

            _commandResultsLogger.Trace(() => XmlUtility.SerializeServerCallInfoToXml(result, serverCallID));
            _performanceLogger.Write(stopwatch, "RhetosService: Executed " + string.Join(",", commands.Select(c => c.CommandName)) + ".");

            return result;
        }
Ejemplo n.º 3
0
        private ServerProcessingResult ExecuteInner(ServerCommandInfo[] commands)
        {
            var stopwatch = Stopwatch.StartNew();

            if (_commandsByName == null)
                PrepareCommandByName();

            if (commands == null || commands.Length == 0)
                return new ServerProcessingResult { SystemMessage = "Commands missing", Success = false };

            if (XmlUtility.Dom == null)
                lock (XmlUtility.DomLock)
                    if (XmlUtility.Dom == null)
                        XmlUtility.Dom = _domainObjectModel.ObjectModel;

            _performanceLogger.Write(stopwatch, "RhetosService.ExecuteInner: Server initialization done.");

            var processingCommandsOrError = Deserialize(commands);
            if (processingCommandsOrError.IsError)
                return new ServerProcessingResult
                    {
                        Success = false,
                        SystemMessage = processingCommandsOrError.Error
                    };
            var processingCommands = processingCommandsOrError.Value;

            _performanceLogger.Write(stopwatch, "RhetosService.ExecuteInner: Commands deserialized.");

            var result = _processingEngine.Execute(processingCommands);

            _performanceLogger.Write(stopwatch, "RhetosService.ExecuteInner: Commands executed.");

            var convertedResult = ConvertResult(result);

            _performanceLogger.Write(stopwatch, "RhetosService.ExecuteInner: Result converted.");

            return convertedResult;
        }