locked
Persisting Complex In Arguments In WF 4 RRS feed

  • Question

  • Hi,

      How can i Workflow with complex Inarguments,ie i am using wpf designer for my activity and i am setting an ingurment (List<CustomType>MyArgument) from the designer.How can i persist "MyArgument"

    Thank you
    Wednesday, August 31, 2011 6:56 AM

Answers

  • Hi,

     

    You can make your custom type serializable .

    The default serilier should be able to do the job . if not you have to write your own custom serializer.

    try this.

    http://dotnetrobert.com/?q=node/200

    For your information.

    WorkflowMarkupSerializer does not support serialization of nested types.

    The functionality of WorkflowMarkupSerializer is dependent on functionality of other types outside of Windows Workflow Foundation. Based on the limitations of those other types, not all data types can be serialized through the WorkflowMarkupSerializer. The following is a list is an example of some unsupported types.

    Arrays (supported only if property is not decorated with DesignerSerializationVisibility.Content attribute value)

    Types without parameterless constructors

    Multidimensional Arrays

    Generic types (Generic List and Dictionary types supported only if property is decorated with DesignerSerializationVisibility.Content attribute value)

    Hashtable

    Queue

    Stack

    XmlDocument

    MailMessage

    Bitmap

    Enumeration Arrays

    Enumerations decorated with the FlagsAttribute

    In addition to this list, any property decorated with both the ContentPropertyAttibute and the DesignerSerializationVisibilityAttribute cannot be serialized by WorkflowMarkupSerializer.

    Thanks,

    Madhur


    MB
    • Proposed as answer by MadhurBhardwaj Thursday, September 1, 2011 11:11 AM
    • Marked as answer by RamuNeST Thursday, September 1, 2011 11:14 AM
    Thursday, September 1, 2011 10:38 AM

All replies

  • Hi ,

    Can you elaborate your question.

    I am not able to understand it .

    Regards,

    Madhur


    MB
    Wednesday, August 31, 2011 3:53 PM
  • Hi Madhur,

                 I want to set an InArgument,which is a list of custom datatype(List<MyClass>MyInargument),from the GUI that i created for that activity.

    i am able to set and persist the inarguments of type list<string>Mysimple_argument,using the model item,but in the case of custom datatypes,i am able to..persist the values.

    awaiting your response

    Thank you


    Thursday, September 1, 2011 4:07 AM
  • Hi Madhur,

     

    Are you custom types Serializable?

    Thursday, September 1, 2011 5:09 AM
  • i have code for serailizing lists,custom types are not serailizable,if necessary i can make it serailizable
    Thursday, September 1, 2011 5:28 AM
  • I suspect that would be a good thing.  If the class isn't serializeable, how could the persistence engine serialize it to the database?  (Assuming of course that when you refer to "Persist the values" you mean to a database....)
    Thursday, September 1, 2011 5:36 AM
  • no i dont want save it in db,i am trying to save it in the same xaml defining the workflow.
    Thursday, September 1, 2011 5:38 AM
  • So far as I know you can't do that, and I'm not sure why you would want to.

     

    If you need to supply values to a workflow you can define arguments in the designer.  After that your run-time environment is responsible for supplying those arguments to the workflow instance when it starts it.

     

    My understanding is that the workflow is the template for a process (the process may get persisted), but it is not a spot to store data.

    Thursday, September 1, 2011 7:11 AM
  • But in the case ordinary arguments,if we use

     

    this.ModelItem.Properties["ProcessOrderMgmt"].SetValue("Optimize");

    this value gets stored in the xaml as i show below,same is for a list of string.I want to dooo the same for my List of custom type

     

    <Activity mc:Ignorable="sap" x:Class="ActivityLibrary1.Activity1" 

    ...

     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <

     

     

    niae:CJCreate CellStudioLib="{x:Null}" Equipment="{x:Null}" MaterialOutSpec="{x:Null}" ProcessingCtrlSpec="{x:Null}" ReportSession="{x:Null}" WorkflowInstanceId="{x:Null}" AutoStart="True" CJID="2" CarrierID="5" sad:XamlDebuggerXmlReader.FileName="E:\Projects\ICEProducts\CellController\branches\CellFTS_Ver2.0\Source\Application Source\NeST.ICC.Activities\ActivityLibrary1\Activity1.xaml" GuiD="8307c296a694d6e98b27e7b6a20694e" sap:VirtualizedContainerService.HintSize="828,492" Name="CJCreate" ObjectSpecifier="&quot;&quot;test" ProcessOrderMgmt="Optimize"

    >

    <

     

     

    niae:CJCreate.CarrierInputSpec

    >

    <

     

     

    scg3:List x:TypeArguments="x:String" Capacity="4"

    >

    <

     

     

    x:String>sdasdasd</x:String

    >

    </

     

     

    scg3:List

    >

    </

     

     

    niae:CJCreate.CarrierInputSpec

    >

    <

     

     

    niae:CJCreate.PauseEvents

    >

    <

     

     

    scg3:List x:TypeArguments="s:UInt32" Capacity="4"

    >

    <

     

     

    s:UInt32>44</s:UInt32

    >

    <

     

     

    s:UInt32>44</s:UInt32

    >

    </

     

     

    scg3:List

    >

    </

     

     

    niae:CJCreate.PauseEvents

    >

    </

     

     

    niae:CJCreate

    >

    </

     

     

    Activity

    >

    Thursday, September 1, 2011 7:42 AM
  • I think someone more knowledgeable than I will have to take this on.

     

    Sorry.

    Thursday, September 1, 2011 8:09 AM
  • Hi,

     

    You can make your custom type serializable .

    The default serilier should be able to do the job . if not you have to write your own custom serializer.

    try this.

    http://dotnetrobert.com/?q=node/200

    For your information.

    WorkflowMarkupSerializer does not support serialization of nested types.

    The functionality of WorkflowMarkupSerializer is dependent on functionality of other types outside of Windows Workflow Foundation. Based on the limitations of those other types, not all data types can be serialized through the WorkflowMarkupSerializer. The following is a list is an example of some unsupported types.

    Arrays (supported only if property is not decorated with DesignerSerializationVisibility.Content attribute value)

    Types without parameterless constructors

    Multidimensional Arrays

    Generic types (Generic List and Dictionary types supported only if property is decorated with DesignerSerializationVisibility.Content attribute value)

    Hashtable

    Queue

    Stack

    XmlDocument

    MailMessage

    Bitmap

    Enumeration Arrays

    Enumerations decorated with the FlagsAttribute

    In addition to this list, any property decorated with both the ContentPropertyAttibute and the DesignerSerializationVisibilityAttribute cannot be serialized by WorkflowMarkupSerializer.

    Thanks,

    Madhur


    MB
    • Proposed as answer by MadhurBhardwaj Thursday, September 1, 2011 11:11 AM
    • Marked as answer by RamuNeST Thursday, September 1, 2011 11:14 AM
    Thursday, September 1, 2011 10:38 AM