コード例 #1
0
        private CreationResult buildProcess(IModel model, IBuildConfiguration buildConfiguration,
                                            params Func <IModel, IBuildConfiguration, ValidationResult>[] steps)
        {
            var result = new CreationResult(model);
            IProgressUpdater progress = null;

            try
            {
                if (buildConfiguration.ShowProgress)
                {
                    progress = _progressManager.Create();
                    progress.Initialize(steps.Length, Messages.CreatingModel);
                }

                foreach (var step in steps)
                {
                    //call each build process with the model and the buildconfiguration
                    result.Add(step(model, buildConfiguration));

                    progress?.IncrementProgress();

                    //if the result has become invalid, stop the build process
                    if (result.IsInvalid)
                    {
                        break;
                    }
                }
            }
            finally
            {
                progress?.Dispose();
            }

            return(result);
        }