static void GenerateImplentation(string outdir, string namespace_, Type type) { var codeGen = new CalleeProxyCodeGenerator(namespace_); var code = codeGen.GenerateCode(type); var interfaceName = GetInterfaceName(type); var fileName = interfaceName + "Proxy.cs"; File.WriteAllText(Path.Combine(outdir, fileName), code); }
private static void GenerateCodeAndThrowException <T>() where T : class { CalleeProxyCodeGenerator generator = new CalleeProxyCodeGenerator(typeof(T).Namespace + ".Generated"); string generatedCode = generator.GenerateCode(typeof(T)); throw new NotSupportedException ("No runtime type code generation available on this platform." + " You might want to try to use this method using the type declared in the inner exception.", new GeneratedCodeException(generatedCode)); }
private static Exception CreateExceptionWithGeneratedCode <T>() where T : class { CalleeProxyCodeGenerator generator = new CalleeProxyCodeGenerator(typeof(T).Namespace + ".Generated"); string generatedCode = generator.GenerateCode(typeof(T)); return(new NotSupportedException ("No runtime type code generation available on this platform." + " You might want to try using GetProxy with the type declared in the inner exception.", new GeneratedCodeException(generatedCode))); }