private ProxyModel RenderCode() { EnsureWorkspace(); SetClientCode(); ProxyModel proxyModel = GetProxyModel(); WarnNonVirtualMethods(proxyModel); Code.AppendLine(proxyModel.Render()); return(proxyModel); }
private void WarnNonVirtualMethods(ProxyModel model) { model.ServiceGenerationInfo.MethodGenerationInfos.Each(mgi => { MethodInfo method = mgi.Method; if (!method.IsVirtual) { Logger.AddEntry("The method {0}.{1} is not marked virtual and as a result the generated proxy will not delegate properly to the designated remote", LogEventType.Warning, method.DeclaringType.Name, method.Name); OnMethodWarning(new ProxyAssemblyGenerationEventArgs { NonVirtualMethod = method }); } }); }
public GeneratedAssemblyInfo GenerateAssembly() { OnAssemblyGenerating(new ProxyAssemblyGenerationEventArgs { ServiceType = ServiceType, ServiceSettings = ServiceSettings }); ProxyModel proxyModel = RenderCode(); CompilerResults compileResult = AdHocCSharpCompiler.CompileSource(Code.ToString(), FileName, proxyModel.ReferenceAssemblies); if (compileResult.Errors.Count > 0) { throw new CompilationException(compileResult); } GeneratedAssemblyInfo result = new GeneratedAssemblyInfo(FileName, compileResult); result.Save(); OnAssemblyGenerated(new ProxyAssemblyGenerationEventArgs { ServiceType = ServiceType, ServiceSettings = ServiceSettings }); return(result); }