Skip to content

Instantly share code, notes, and snippets.

@btjake
Last active December 30, 2015 20:09
Show Gist options
  • Save btjake/7879305 to your computer and use it in GitHub Desktop.
Save btjake/7879305 to your computer and use it in GitHub Desktop.
An example of what I'm trying to do w/ServiceStack
public class HelloService : Service
{
public object NamedMethod(Hello request)
{
return new HelloResponse { Result = "Hello, " + request.Name };
}
}
public class HelloResponse
{
public string Result { get; set; }
}
public class Hello
{
public string Name { get; set; }
}
public class Global : System.Web.HttpApplication
{
public class AppHost : AppHostBase
{
public AppHost() : base("Hello Web Services", typeof(HelloService).Assembly) { }
protected void Application_Start(object sender, EventArgs e) { new AppHost().Init(); }
public override void Configure(Funq.Container container)
{
//This would be the way to map it up with a funciton called "Any"
Routes.Add<Hello>("/hello", ApplyTo.All);
//This is how I would imagine mapping it to another function
Routes.Add<Hello, HelloService>("/hello", ApplyTo.All, (svc) => svc.NamedMethod);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment