WorkflowMarkupSerializer doesn't keep positions in a state machine workflow

Posted by Khadaji on Stack Overflow See other posts from Stack Overflow or by Khadaji
Published on 2009-04-09T00:50:49Z Indexed on 2010/04/06 18:33 UTC
Read the original article Hit count: 460

Filed under:
|
|

I am using WorkflowMarkupSerializer to save a statemachine workflow - it saves the states OK, but does not keep their positions. The code to write the workflow is here:

        using (XmlWriter xmlWriter = XmlWriter.Create(fileName))
        {
            WorkflowMarkupSerializer markupSerializer
                = new WorkflowMarkupSerializer();
            markupSerializer.Serialize(xmlWriter, workflow);
        }

The code to read the workflow is:

            DesignerSerializationManager dsm
            = new DesignerSerializationManager();
        using (dsm.CreateSession())
        {
            using (XmlReader xmlReader
                = XmlReader.Create(fileName))
            {
                //deserialize the workflow from the XmlReader
                WorkflowMarkupSerializer markupSerializer
                    = new WorkflowMarkupSerializer();
                workflow = markupSerializer.Deserialize(
                    dsm, xmlReader) as Activity;

                if (dsm.Errors.Count > 0)
                {
                    WorkflowMarkupSerializationException error
                        = dsm.Errors[0]
                          as WorkflowMarkupSerializationException;
                    throw error;
                }
            }
         }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET