MSDN > Home page del forum > SharePoint - Workflow > Sharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable".
Formula una domandaFormula una domanda
 

Con rispostaSharepoint Custom Activity for workflows : dependency property which is of type "Typed DataTable".

  • lunedì 5 gennaio 2009 10.57MonicaT Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Hi,

    I m creating a sharepoint custom activity for workflows.
    Can someone please tell me if it is feasible to create a dependency property which is of type "Typed DataTable"?


    I have created a property as:

    public static DependencyProperty DtProperty = DependencyProperty.Register("DtProperty", typeof(TypedDataTable.DataTable), typeof(Activity.OperationActivity));

    [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]

    [BrowsableAttribute(true)]

    [CategoryAttribute("Misc")]

    public TypedDataTable.DataTable dt1
    {

    get

    {

    return ((TypedDataTable.DataTable)(base.GetValue(Activity.OperationActivity.DtProperty )));

    }

    set

    {

    base.SetValue(Activity.OperationActivity.DtProperty  value);

    }

    }


    It gives me below error message:
    Could not create activity of type 'Activity.OperationActivity'. System.ArgumentException: Type 'Activity.OperationActivity' does not define a static dependency property with name 'DtPropertyProperty'.
    Parameter name: ownerType
       at System.Workflow.ComponentModel.DependencyProperty.ValidateAndRegister(String name, Type propertyType, Type ownerType, PropertyMetadata defaultMetadata, Type validatorType, Boolean isRegistered)
       at System.Workflow.ComponentModel.DependencyProperty.Register(String name, Type propertyType, Type ownerType)
       at Activity.OperationActivity..cctor()


    Any help on this??

Risposte

  • mercoledì 7 gennaio 2009 1.39Windie Chai [MVP]MVPMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con rispostaContiene codice
     Hi,

    The correct code should be:

    public static DependencyProperty DtProperty = DependencyProperty.Register("dt1", typeof(TypedDataTable.DataTable), typeof(Activity.OperationActivity));
    ......
    public
     TypedDataTable.DataTable
    dt1
    {
    ......
    }

    the 1st parameter of Register method must be a correct valid property name, and the 2nd parameter is the type of that property.

    And I must remind you, if you want to use this property in SharePoint workflow, please ensure TypedDataTable.DataTable can be serialize.


    My blog: http://xiaoshatian.cnblogs.com

Tutte le risposte

  • lunedì 5 gennaio 2009 13.42Michael Washam - MSFTMSFT, ModeratoreMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     
    Moving to the workflow forums
    Posting is provided "AS IS" with no warranties, and confers no rights.
  • mercoledì 7 gennaio 2009 1.39Windie Chai [MVP]MVPMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     Con rispostaContiene codice
     Hi,

    The correct code should be:

    public static DependencyProperty DtProperty = DependencyProperty.Register("dt1", typeof(TypedDataTable.DataTable), typeof(Activity.OperationActivity));
    ......
    public
     TypedDataTable.DataTable
    dt1
    {
    ......
    }

    the 1st parameter of Register method must be a correct valid property name, and the 2nd parameter is the type of that property.

    And I must remind you, if you want to use this property in SharePoint workflow, please ensure TypedDataTable.DataTable can be serialize.


    My blog: http://xiaoshatian.cnblogs.com