public Boolean SaveAllInstanceData(Guid instanceId, SaveWorkflowCommand command)
{
Boolean isExistingInstance;
try
{
String fileName = String.Format("{0}.xml", instanceId);
String fullPath = Path.Combine(_dataDirectory, fileName);
isExistingInstance = File.Exists(fullPath);
XElement root = new XElement("Instance");
root.Add(new XAttribute("WorkflowInstanceId", instanceId));
XDocument xml = new XDocument(root);
NetDataContractSerializer serializer = new NetDataContractSerializer();
XElement section = new XElement("InstanceData");
root.Add(section);
foreach(var entry in command.InstanceData)
{
SaveSingleEntry(serializer, section, entry);
}
SaveInstanceDocument(fullPath, xml);
}
catch(Exception exception)
{
Dev2Logger.Log.Error(exception);
throw new InstancePersistenceException(exception.Message, exception);
}
return isExistingInstance;
}