public GeneratedClass ToClass(GenerationRules rules) { try { var @class = new GeneratedClass(rules, TypeName) { BaseType = typeof(RouteHandler) }; var frames = DetermineFrames(); var method = new GeneratedMethod(nameof(RouteHandler.Handle), new Argument[] { Argument.For <HttpContext>(RouteGraph.Context) }, frames) { Overrides = true }; method.Sources.Add(new ContextVariableSource()); method.DerivedVariables.AddRange(HttpContextVariables); @class.AddMethod(method); return(@class); } catch (Exception e) { throw new CodeGenerationException(this, e); } }
public GeneratedClass ToClass(GenerationRules rules) { try { var @class = new GeneratedClass(rules, TypeName) { BaseType = typeof(MessageHandler) }; var method = new HandleMessageMethod(DetermineFrames()); method.Sources.Add(new MessageHandlerVariableSource(MessageType)); @class.AddMethod(method); return(@class); } catch (Exception e) { throw new CodeGenerationException(this, e); } }