public static string GenerateExpression(IOclExpression expression, bool useMetamodelInterface)
 {
     if (expression is IOperationCallExp)
     {
         IOperationCallExp value = (IOperationCallExp)expression;
         return("transformation.Functions." + value.ReferredOperation.Name + "(" + string.Join(",", value.Argument.Select(u => GenerateExpression(u, useMetamodelInterface))) + ")");
     }
     if (expression is CSharpOpaqueExpression)
     {
         CSharpOpaqueExpression value = (CSharpOpaqueExpression)expression;
         return(value.Code);
     }
     if (expression is IVariableExp)
     {
         return(((IVariableExp)expression).ReferredVariable.Name);
     }
     if (expression is Assignment)
     {
         Assignment assignment = (Assignment)expression;
         return(assignment.AssignedVariable.Type.GetRealTypeName() + " " + assignment.AssignedVariable.Name + " = " + GenerateExpression(assignment.Value, useMetamodelInterface));
     }
     if (expression is IRelationCallExp)
     {
         IRelationCallExp relationCallExp = (IRelationCallExp)expression;
         return("transformation." + QvtCodeGeneratorStrings.RelationClassName(relationCallExp.ReferredRelation)
                + ".CheckAndEnforce(" + string.Join(",", relationCallExp.Argument.Select(u => GenerateExpression(u, useMetamodelInterface))) + ")");
     }
     throw new CodeGeneratorException("Cannot manage expression: " + expression);
 }
 private void GenerateString(IRelationCallExp relationCall)
 {
     Write("#RelationCallExp[" + relationCall.ReferredRelation.Name + "(");
     foreach (IOclExpression arg in relationCall.Argument)
     {
         GenerateString(arg);
         if (relationCall.Argument.Last() != arg)
         {
             Write(", ");
         }
     }
     Write(")]");
 }
 public static string GenerateAssignmentsFromRelationCall(IRelationCallExp relationCallExp, bool useMetamodelInterface)
 {
     return("transformation." + QvtCodeGeneratorStrings.RelationClassName(relationCallExp.ReferredRelation)
            + ".FindPreviousResult(" + string.Join(",", relationCallExp.Argument.Take(relationCallExp.ReferredRelation.Domain.Count(d => !d.IsEnforceable.GetValueOrDefault())).Select(u => GenerateExpression(u, useMetamodelInterface))) + ")");
 }