Creating the metadata provider
To create the metadata provider, perform the following procedure:
-
From the context menu of folder Data, click Add » Class...
-
In the Name input field, enter TestimonialsMetaDataProvider.
-
Open the file TestimonialsMetaDataProvider.cs and add the following namespaces:
using Telerik.OpenAccess.Metadata;
using Telerik.Sitefinity.Data;
using Telerik.Sitefinity.Data.OA;
using Telerik.Sitefinity.Model;
-
Change the class definition to:
public class TestimonialsMetaDataProvider : IOpenAccessMetadataProvider, IOpenAccessCustomContextProvider
{
}
-
Create the GetMetaDataSource method by pasting the following code:
public MetadataSource GetMetaDataSource(IDatabaseMappingContext context)
{
return new TestimonialsFluentMetaDataSource();
}
-
Create the GetContext method by pasting the following code:
public SitefinityOAContext GetContext(string connectionString, Telerik.OpenAccess.BackendConfiguration backendConfig, MetadataContainer metadataContainer)
{
return new TestimonialsContext(connectionString, backendConfig, metadataContainer);
}
-
Provide the module name property by pasting the following code:
public string ModuleName
{
get { return TestimonialsModule.ModuleName; }
}
You inherit from IOpenAccessMetadataProvider and IOpenAccessCustomContextProvider. You create methods for getting the metadata source and the context. Then, you create property for the module name.