Search code examples
c#workflow-foundation

literal error while working with c# asp.net/ wf


I made a drag-and-drop workflow, and got an Literal error while passing an object through the INargument. Any ideas how I can get around this error?

error: 'Literal': Literal only supports value types and the immutable type System.String. The type System.Object cannot be used as a literal.

I've seen some answers, but all the examples are in hard-coded workflows, and I don't want rewrite the whole workflow in hard-code.

WorkflowActivitycheckdb ActEmail = new WorkflowActivitycheckdb { 
    EmailList = AdminsToList, 
    EmailContent = tolist, 
    UserName = name, 
    UnApprovedS = UnApproved, 
    NumberOfUsers = tel, 
    NumberOfAdmins = tel2 
}; 
WorkflowInvoker.Invoke(ActEmail);

please help.


Solution

  • WorkflowActivitycheckdb ActEmail = new WorkflowActivitycheckdb { 
        EmailList = new InArgument<Whateveryourobjectis>( x=> AdminsToList), 
        EmailContent = tolist, 
        UserName = name, 
        UnApprovedS = UnApproved, 
        NumberOfUsers = tel, 
        NumberOfAdmins = tel2 
    }; 
    WorkflowInvoker.Invoke(ActEmail);
    

    gl