none
How do I deserialize varbinary promoted properties

    Question

  • How does SqlWorkflowInstanceStoreBehavior.Promote() serialize objects into varbinary(max) columns in the System.Activities.DurableInstancing.InstancePromotedPropertiesTable? More importantly, how can I deserialize these persisted objects?


    Art Schmidt

    Friday, March 01, 2013 8:20 PM

Answers

  • ManuSrivastava's answer to this older post does work:

    http://social.msdn.microsoft.com/Forums/en-US/windowsworkflowfoundation/thread/bec903b9-5bd5-4b7d-b318-e74bd7a8c748

    Also, an additional response he posted to the same question gives more insight:

    We feed all varbinary(max) objects through a serializer, regardless of the type. This means that the byte[] array he promotes is serialized using NetDataContractSerializer must be deserialized with a NetDataContractSerializer. In other words, you can’t just promote a byte[] array and expect it to be equivalent to what is stored in the DB…you have to deserialize the blob stored in the Promotion Table to get the original byte[] array back.

    We did this to enable users to promote all types of complex objects (e.g. custom .NET classes) without having to worry about serializing them.
    We intend to publish documentation that describes deserializing the Promoted Binary column.

    Unfortunately, it doesn't appear the intended documentation was ever published, at least I've been unable to find any.


    Art Schmidt

    • Marked as answer by atsjr Friday, March 01, 2013 9:48 PM
    Friday, March 01, 2013 9:47 PM

All replies

  • ManuSrivastava's answer to this older post does work:

    http://social.msdn.microsoft.com/Forums/en-US/windowsworkflowfoundation/thread/bec903b9-5bd5-4b7d-b318-e74bd7a8c748

    Also, an additional response he posted to the same question gives more insight:

    We feed all varbinary(max) objects through a serializer, regardless of the type. This means that the byte[] array he promotes is serialized using NetDataContractSerializer must be deserialized with a NetDataContractSerializer. In other words, you can’t just promote a byte[] array and expect it to be equivalent to what is stored in the DB…you have to deserialize the blob stored in the Promotion Table to get the original byte[] array back.

    We did this to enable users to promote all types of complex objects (e.g. custom .NET classes) without having to worry about serializing them.
    We intend to publish documentation that describes deserializing the Promoted Binary column.

    Unfortunately, it doesn't appear the intended documentation was ever published, at least I've been unable to find any.


    Art Schmidt

    • Marked as answer by atsjr Friday, March 01, 2013 9:48 PM
    Friday, March 01, 2013 9:47 PM
  • Hi,

    I'm glad to hear that you resolve this issue.

    Best Regards,


    Chen Yu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 04, 2013 3:00 AM