Exemple #1
0
        public void Execute(ExecutingProcess executingProcess)
        {
            PackageOperationEntity package = (PackageOperationEntity)executingProcess.Data;

            OperationSymbol operationSymbol = package.Operation;

            var args = package.OperationArgs;

            executingProcess.ForEachLine(package.Lines().Where(a => a.FinishTime == null), line =>
            {
                OperationType operationType = OperationLogic.OperationType(line.Target.GetType(), operationSymbol);

                switch (operationType)
                {
                case OperationType.Execute:
                    OperationLogic.ServiceExecute(line.Target, operationSymbol, args);
                    break;

                case OperationType.Delete:
                    OperationLogic.ServiceDelete(line.Target, operationSymbol, args);
                    break;

                case OperationType.ConstructorFrom:
                    {
                        var result  = OperationLogic.ServiceConstructFrom(line.Target, operationSymbol, args);
                        line.Result = result.ToLite();
                    }
                    break;

                default:
                    throw new InvalidOperationException("Unexpected operation type {0}".FormatWith(operationType));
                }

                line.FinishTime = TimeZoneManager.Now;
                line.Save();
            });
        }