public override void ExecuteResult(ControllerContext context) { string defaultBaseAddress = ServiceProxySystem.GetBaseAddress(new RequestWrapper(context.HttpContext.Request)); StringBuilder code = GenerateCSharpProxyCode(defaultBaseAddress); context.HttpContext.Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName + ".cs"); context.HttpContext.Response.AddHeader("Content-Type", "text/plain"); context.HttpContext.Response.Write(code.ToString()); }
public override string GetProxyCode(Incubator serviceProvider, IHttpContext context) { IRequest request = context.Request; IResponse response = context.Response; string defaultBaseAddress = ServiceProxySystem.GetBaseAddress(request); string nameSpace = request.QueryString["namespace"] ?? "ServiceProxyClients"; string contractNameSpace = "{0}.Contracts"._Format(nameSpace); string[] classNames = request.QueryString["classes"] == null ? serviceProvider.ClassNames : request.QueryString["classes"].DelimitSplit(",", ";"); bool includeLocalMethods = request.UserHostAddress.StartsWith("127.0.0.1"); return(Generate(defaultBaseAddress, classNames, nameSpace, contractNameSpace, serviceProvider, Logger, includeLocalMethods).ToString()); }