Creating the metadata provider

To create the metadata provider, perform the following procedure:

  1. From the context menu of folder Data, click Add » Class...

  2. In the Name input field, enter TestimonialsMetaDataProvider.

  3. 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;

  4. Change the class definition to:

    public class TestimonialsMetaDataProvider : IOpenAccessMetadataProvider, IOpenAccessCustomContextProvider
    {
     
    }

  5. Create the GetMetaDataSource method by pasting the following code:

    public MetadataSource GetMetaDataSource(IDatabaseMappingContext context)
    {
        return new TestimonialsFluentMetaDataSource();
    }

  6. 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);
    }

  7. 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.

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK