Creating the configuration class
The configuration class is a simple class which provides module configuration capabilities. The configuration class described in this section sets OpenAccessJobsDataProvider as the default provider and the default backend view.
To implement the configuration class, perform the following:
-
From the context menu of folder Configuration, click Add » New Item...
-
In the left pane, select Visual C# » Code.
-
Click Class and in the Name input field, enter JobsConfig.
-
Open the file JobsConfig.cs and add the following namespaces:
using Jobs.Data;
using Jobs.Resources;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Modules.GenericContent.Configuration;
using Telerik.Sitefinity.Web.UI.ContentUI.Config;
-
Change the class definition to:
public class JobsConfig : ContentModuleConfigBase
{
}
-
Implement ContentModuleConfigBase by pasting the following code:
protected override void InitializeDefaultProviders(ConfigElementDictionary<string, DataProviderSettings> providers)
{
providers.Add(new DataProviderSettings(this.Providers)
{
Name = "OpenAccessDataProvider",
Description = "A provider that stores jobs data in a database using OpenAccess ORM.",
ProviderType = typeof(OpenAccessJobsDataProvider)
});
}
protected override void InitializeDefaultViews(ConfigElementDictionary<string, ContentViewControlElement> contentViewControls)
{
contentViewControls.Add(JobsDefinitions.DefineJobsBackendContentView(contentViewControls));
}
You inherit from ContentModuleConfigBase. Inside the InitializeDefaultProviders method, the JobsConfig class setsOpenAccessJobsDataProvider as the default provider. In InitializeDefaultViews you set the default backend view.