Skip to content

Instantly share code, notes, and snippets.

@isdaviddong
Created December 23, 2016 03:21
Show Gist options
  • Save isdaviddong/c3a33d92fcbba8f18e3f24c2ffe1cbad to your computer and use it in GitHub Desktop.
Save isdaviddong/c3a33d92fcbba8f18e3f24c2ffe1cbad to your computer and use it in GitHub Desktop.
public class ExampleController : ApiController
{
[Route("api/Example/{MethodName}")]
[HttpPost]
public IHttpActionResult ExecuteMethod(string MethodName)
{
try
{
//AssemblyLauncher
AssemblyLauncher assemblyLauncher = new AssemblyLauncher();
//執行指定的Method
var ret = assemblyLauncher.ExecuteCommand<TestClassA>(
new TestClassA(),
MethodName,
Request.Content.ReadAsStringAsync().Result);
//回傳OK
return Ok(ret);
}
catch (Exception ex)
{
//其他處理
throw ex;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment