public static ExecutionResponseApiModel ToApiModel(ExecutionContext coreModel) { var apiModel = new ExecutionResponseApiModel { CreatedDateTimeUtc = coreModel.CreatedDateTimeUtc, ExecutionId = coreModel.ExecutionId, ExecutionModelName = coreModel.ExecutionModelName, ExecutionProfileName = coreModel.ExecutionProfileName, ExecutionTimeoutDateTimeUtc = coreModel.ExecutionTimeoutDateTimeUtc, Executor = coreModel.Executor.ToApiModel(), ExecutorProperties = coreModel.ExecutorProperties, ExtensionId = coreModel.ExtensionId, ExtensionVersionId = coreModel.ExtensionVersionId, LastUpdatedDateTimeUtc = coreModel.LastUpdatedDateTimeUtc, ObjectProviderName = coreModel.ObjectProviderName, PercentComplete = coreModel.PercentComplete, Priority = coreModel.Priority, ResultData = coreModel.ResultData, Status = coreModel.Status, StatusMessage = coreModel.StatusMessage, StatusUpdateKey = coreModel.StatusUpdateKey, SupportedServices = coreModel.SupportedServices, ValidationErrors = coreModel.ValidationErrors.Select(e => e.ToApiModel()).ToList() }; ApplyInputObjectsToApiModel(coreModel, apiModel); ApplyOutputObjectsToApiModel(coreModel, apiModel); return(apiModel); }
private static ExecutionResponseApiModel ApplyOutputObjectsToApiModel(ExecutionContext coreModel, ExecutionResponseApiModel apiModel) { foreach (var objectName in coreModel.OutputObjects.Keys) { var ooCoreModel = coreModel.OutputObjects[objectName]; var ooApiModel = ooCoreModel.ToApiModel(); ooApiModel.IsProvided = coreModel.ProvidedOutputObjects.Contains(objectName); apiModel.OutputObjects.Add(objectName, ooApiModel); } return(apiModel); }
private static ExecutionContext ApplyOutputObjectsToCoreModel(ExecutionContext coreModel, ExecutionResponseApiModel apiModel) { foreach (var objectName in apiModel.OutputObjects.Keys) { var ooApiModel = apiModel.OutputObjects[objectName]; var ooCoreModel = ooApiModel.ToCoreModel(objectName); coreModel.OutputObjects.Add(objectName, ooCoreModel); if (ooApiModel.IsProvided) { coreModel.ProvidedOutputObjects.Add(objectName); } } return(coreModel); }