Skip to content

Instantly share code, notes, and snippets.

@Dheer-Rajpoot
Created March 31, 2017 07:14
Show Gist options
  • Save Dheer-Rajpoot/03ddb34eb19f0b2206bf575a011fa8de to your computer and use it in GitHub Desktop.
Save Dheer-Rajpoot/03ddb34eb19f0b2206bf575a011fa8de to your computer and use it in GitHub Desktop.
public class XMLSystemEndpointConverter : BaseEndpointConverter<ItemModel>
{
//the id from the endpoint template you created named XML Endpoint.
private static readonly Guid TemplateId = Guid.Parse("{CC05EF8C-F4C8-4EB9-A39A-8E71F978C1DD}");
public XMLSystemEndpointConverter(IItemModelRepository repository) : base(repository)
{
//identify the template an item must be based
//on in order for the converter to be able to
//convert the item
this.SupportedTemplateIds.Add(TemplateId);
}
protected override void AddPlugins(ItemModel source, Endpoint endpoint)
{
//create the plugin
var settings = new XMLSystemSettings();
//populate the plugin using values from the item
settings.XMLPath = base.GetStringValue(source, XMLSystemEndpointItemModel.XMLPath);
settings.XMLNodeName = base.GetStringValue(source, XMLSystemEndpointItemModel.XMLNodeName);
//add the plugin to the endpoint
endpoint.Plugins.Add(settings);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment