Created
April 22, 2016 14:34
-
-
Save sitefinitysteve/3c7de0ad683363af23e8c1bc204fb0f5 to your computer and use it in GitHub Desktop.
ServiceStack template for sitefinity
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 MySite { | |
#region PLUGIN | |
public class MyServicePlugin : IPlugin | |
{ | |
/// <summary> | |
/// Call this in your Global.asax.cs in the Sitefinity Bootstrapper_Initalized event | |
/// Example: http://docs.sitefinity.com/for-developers-idataevent | |
/// void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e) { | |
/// if (e.CommandName == "Bootstrapped") | |
/// { | |
/// SystemManager.RegisterServiceStackPlugin(new MySite.MyServicePlugin()); | |
/// } | |
/// } | |
/// </summary> | |
public void Register(IAppHost appHost) | |
{ | |
appHost.RegisterService(typeof(MyService)); | |
} | |
} | |
#endregion | |
#region SERVICE | |
public class MyService : IService { | |
// Any means will accept GET, POST, PUT, etc... can just be "Get" if you dont want the others | |
public object Any(MyRequest request) { | |
return "Hello World"; | |
} | |
} | |
#endregion | |
#region REQUEST | |
[Route("/route")] | |
public class MyRequest : IReturn<string> { | |
//This is where you add your querystring or POST params | |
public string SearchTerm { get; set; } | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment