using System.Collections.Generic;
using System.Xml.Serialization;
using System.Threading.Tasks;
using System.Diagnostics;
[XmlRoot("BaseSyncOneWayInput")]
public class BaseSyncOneWayInput<TPrimaryKey>
public String Filter { get; set; }
public Object[] Parameters { get; set; }
public List<TPrimaryKey> ExistingIds { get; set; }
public abstract class XmlParser<T> where T : new()
public static string ObjectToXML(T obj)
MemoryStream stream = new MemoryStream();
using (StreamWriter reader = new StreamWriter(stream))
XmlRootAttribute xRoot = new XmlRootAttribute();
xRoot.ElementName = typeof(T).Name;
XmlSerializer serializer = new XmlSerializer(typeof(T),xRoot);
serializer.Serialize(stream, obj);
private static String ToString(Stream s)
using (StreamReader reader = new StreamReader(s, Encoding.UTF8))
return reader.ReadToEnd();
public static string Pull<TPrimaryKey>(string apiUrl = null, string filter = null, object[] parameters = null, Dictionary<string, object> remoteParameters = null)
var baseSyncInput = new BaseSyncOneWayInput<TPrimaryKey>()
Filter = filter, Parameters = parameters,
ExistingIds = new List<TPrimaryKey>()
var xml = XmlParser<BaseSyncOneWayInput<TPrimaryKey>>.ObjectToXML(baseSyncInput);
public static void Main()
Console.WriteLine(Pull<string>());