private static void UpdatePipeline(CodeCompileUnit code, string[] requestHandlers) { var containsStop = requestHandlers.Contains("AMAZON.StopIntent".Safe()); var array = new CodeArrayCreateExpression(new CodeTypeReference("IAlexaRequestHandler<APLSkillRequest>[]")); foreach (var requestHandler in requestHandlers.OrderBy(rh => rh.Length)) { array.Initializers.Add(new CodeObjectCreateExpression(requestHandler.Safe())); } if (!containsStop) { array.Initializers.Add(new CodeObjectCreateExpression("AMAZON.StopIntent".Safe())); } array.Initializers.Add(new CodeObjectCreateExpression("AMAZON.FallbackIntent".Safe())); var pipeline = new CodeObjectCreateExpression(new CodeTypeReference("AlexaRequestPipeline<APLSkillRequest>"), array); var constructor = code.FirstType().Members.OfType <CodeTypeConstructor>().First(); constructor.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression("_pipeline"), pipeline)); }