Last active
August 26, 2016 07:33
-
-
Save hardye/7021091 to your computer and use it in GitHub Desktop.
A simple "hello world" sample illustrating the integration of ServiceStack with Sitefinity as of version 6.2
This file contains hidden or 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
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()); | |
} | |
} | |
} |
This file contains hidden or 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
using System; | |
using System.Linq; | |
namespace Services.Response | |
{ | |
public class Greeting | |
{ | |
public string Text { get; set; } | |
} | |
} |
This file contains hidden or 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
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; } | |
} | |
} |
This file contains hidden or 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
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) }; | |
} | |
} | |
} |
This file contains hidden or 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
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