Sitefinity CMS

Implementing Custom Services Send comments on this topic.
See Also
Developing with Sitefinity > Services > Adding a New Service to Sitefinity > Implementing Custom Services

Glossary Item Box

This topic gives some guidance for using services in Sitefinity.

 

Implementing Services in Sitefinity

What needs to be done is to write a class that implements the IService interface. Also, information about the service should be added to the web.config file as shown in the following code:

web.config Copy Code
<framework>
 
...
 
<services>
   
<add type="Your_Service_Class, The_Class_Assembly"/>
   
...
 
</services>  

 

To view the service in the Admin part of Sitefinity, Administration -> Services tab, the class should also implement WebModule.

 

Sample Implementation

Here is a sample implementation:

Service1.cs Copy Code
using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Telerik.Framework;
using Telerik;

/// <summary>
/// Summary description for Service1
/// </summary>
public class Service1 : WebModule, IService
{
 
public Service1()
 {
        
 }

 
public override System.Collections.Generic.IList<Telerik.Web.IToolboxItem> Controls
 {
   get {
return null; }
 }

 
public override string Description
 {
   get {
return "Test"; }
 }

 
public override string Name
 {
   get {
return "Service1 and 1"; }
 }

 
public override string Title
 {
   get {
return "Service 1"; }
 }
 #region IService Members

 
public void Initialize()
 {
 }
 #endregion
}  


 

Also, add the following highlighted code to the web.config file:

web.config Copy Code
<framework>
 
...
 
<services>
   
<add type="Service1, app_code"/>
   
...
 
</services>  

 

Following is an illustration of where the services are available in the Admin part of Sitefinity:

Implementing Custom Services

Figure 1

 

See Also