Last active
December 30, 2015 20:09
-
-
Save btjake/7879305 to your computer and use it in GitHub Desktop.
An example of what I'm trying to do w/ServiceStack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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