Skip to content

Instantly share code, notes, and snippets.

@sitefinitysteve
Forked from hardye/Global.asax.cs
Created October 18, 2013 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sitefinitysteve/7045166 to your computer and use it in GitHub Desktop.
Save sitefinitysteve/7045166 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using Telerik.Sitefinity.Services;
namespace SitefinityWebApp
{
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
SystemManager.RegisterServiceStackPlugin(new Services.HelloWorldServicePlugin());
}
}
}
using System;
using System.Linq;
namespace Services.Response
{
public class Greeting
{
public string Text { get; set; }
}
}
using System;
using System.Linq;
using ServiceStack.ServiceHost;
using Services.Response;
namespace Services.Request
{
[Route("/hello")]
public class HelloWorld : IReturn<Greeting>
{
public string Name { get; set; }
}
}
using System;
using System.Linq;
using ServiceStack.ServiceInterface;
using Services.Request;
using Services.Response;
using ServiceStack.Text;
namespace Services
{
public class HelloWorldService : Service
{
public Greeting Any(HelloWorld request)
{
return new Greeting() {Text = "Hello, {0}".Fmt(request.Name) };
}
}
}
using System;
using System.Linq;
using ServiceStack.WebHost.Endpoints;
namespace Services
{
public class HelloWorldServicePlugin : IPlugin
{
public void Register(IAppHost appHost)
{
appHost.RegisterService(typeof(HelloWorldService));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment