/// <summary> /// Execute a transformation. /// </summary> /// <param name="domainModel">The input <see cref="IDomainModel"/></param> /// <param name="productionContext">The input <see cref="ProductionContext"/></param> /// <returns></returns> public TransformationResult Transform(IDomainModel domainModel, ProductionContext productionContext) { if (TransformationInfo == null) throw new FactoryException("TransformationInfo must be set before invoking Transform method"); Model = domainModel; AddParameter(Model.ModelTypeName, Model.Name); ProductionContext = productionContext; TransformationResult = new TransformationResult(); ProductionContext.SetCurrentTransformationResult(TransformationResult); OnTransform(); return TransformationResult; }
/// <summary> /// Set the <see cref="TransformationResult"/> instance for the current Transformation, so that /// transformer methods can use the ProductionContext to add items to the TransformationResult. /// </summary> /// <param name="transformationResult"></param> public void SetCurrentTransformationResult(TransformationResult transformationResult) { CurrentTransformationResult = transformationResult; }
/// <summary> /// Accumulate a <see cref="TransformationResult"/> into this ProductionResult /// </summary> /// <param name="transformationResult"></param> public void AccumulateTransformationResult(TransformationResult transformationResult) { foreach (GeneratedArtifact ga in transformationResult.GeneratedArtifacts) AddGeneratedArtifact(ga); foreach (ResourceInfo resource in transformationResult.RequiredResources) AddRequiredResource(resource); foreach (ReferenceInfo reference in transformationResult.RequiredReferences) AddRequiredReference(reference); foreach (FrameworkArtifactDependency fad in transformationResult.FrameworkArtifactDependencies) AddFrameworkArtifactDependency(fad); }