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:
- Create a new class library using Visual Studio that targets .NET Framework version used by the Portal that will host the add-in.
- Add the
Xpertdoc.TemplateManager.AddInNuGet package to the project. - Locate the class
TemplateDataProviderAddInthat was added by the Nuget package installer. - Update the method
GetPropertieswith 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" }
};
}Updated 5 months ago
