Template Data Provider Add-In

A Template Data Provider add-in can be used to provide a template with static or dynamic data.

Template Data Provider add-ins are available for Template Manager applications.

How to build

Follow these steps to create a Template Data Provider add-in:

  1. Create a new class library using Visual Studio that targets .NET Framework version used by the Portal that will host the add-in.
  2. Add the Xpertdoc.TemplateManager.AddIn NuGet package to the project.
  3. Locate the class TemplateDataProviderAddIn that was added by the Nuget package installer.
  4. Update the method GetProperties with the code that will return the values to the template. This code can reference the passed in context.Metadata and context.ContextData properties if values need to be dynamically generated based on that content.

Here's a sample GetProperties implementation:

/// <summary>
/// Gets the properties.
/// </summary>
/// <param name="context">The context.</param>
/// <returns>The template data.</returns>
public IDictionary<string, object> GetProperties(
  ITemplateDataProviderContext context)
{
  if (context == null)
  {
    throw new ArgumentNullException(nameof(context));
  }

  return new Dictionary<string, object> 
  { 
    { "key1", "Value 1" }, 
    { "key2", "Value 2" } 
  };
}