This is everything you need to register a servicestack service in Sitefinity. Just set your Route, and make sure to register the plugin in App_Start.
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Telerik.Sitefinity; | |
using Telerik.Sitefinity.Model; | |
using Telerik.Sitefinity.DynamicModules; | |
using Telerik.Sitefinity.Data.Linq.Dynamic; | |
using Telerik.Sitefinity.Services.Search; | |
using Telerik.Sitefinity.Utilities.TypeConverters; | |
using ServiceStack.Text; | |
using ServiceStack; | |
using Telerik.Sitefinity.DynamicModules.Model; | |
namespace «FieldStart»«TextLink("MyNamespace")»«FieldEnd» { | |
#region PLUGIN | |
public class «Link("Custom")»ServicePlugin : IPlugin | |
{ | |
/// <summary> | |
/// Call this at Global.asax, Application_Start | |
/// SystemManager.RegisterServiceStackPlugin(new «TextLink("MyNamespace")».«Link("Custom")»ServicePlugin()); | |
/// </summary> | |
public void Register(IAppHost appHost) | |
{ | |
appHost.RegisterService(typeof(«Link("Custom")»Service)); | |
} | |
} | |
#endregion | |
#region SERVICE | |
public class «FieldStart»«Caret»«Link("Custom")»«BlockAnchor»«FieldEnd»Service : Service { | |
public object Any(«FieldStart»«Link("MyFirstRequest")»«FieldEnd» request) { | |
return "Hello World"; | |
} | |
} | |
#endregion | |
#region REQUEST | |
[Route("/«FieldStart»«TextLink("route")»«FieldEnd»")] | |
public class «Link("MyFirstRequest")» : IReturn<string> { | |
public string Param1 { get; set; } | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment