Giter VIP home page Giter VIP logo

Comments (5)

danielgerlag avatar danielgerlag commented on July 18, 2024 1

Have you tried casting the EventData, like this?

.Output(data => data.StrValue2, step => (step.EventData as MyDataClass).StrValue2)

from workflow-core.

germandb avatar germandb commented on July 18, 2024

Hi Daniel, I try what you suggest, but doesn't work.
When ProcessOutputs its call the body have the WaitFor object and when try to get the resolvedValue from the body the output is the values object that I pass in the PublishEvent.

When the function try to set the value for the output it fails because resolvedValue its and object and not a string.

I make a change in the ProcessOutputs function to look if resolvedValue get properties and in that case get the value of that property and if not resolve as before.

Could you please look at this,

`private void ProcessOutputs(WorkflowInstance workflow, WorkflowStep step, IStepBody body)
{
foreach (var output in step.Outputs)
{
var member = (output.Target.Body as MemberExpression);
var resolvedValue = output.Source.Compile().DynamicInvoke(body);
var data = workflow.Data;
if (resolvedValue.GetType().GetProperties().Count() > 0)
{
var resolvedData = resolvedValue.GetType().GetProperty(member.Member.Name).GetValue(resolvedValue);

                data.GetType().GetProperty(member.Member.Name).SetValue(data, resolvedData);
            }
            else
            {
                data.GetType().GetProperty(member.Member.Name).SetValue(data, resolvedValue);
            }
        }
    }`

from workflow-core.

danielgerlag avatar danielgerlag commented on July 18, 2024

Could attach the project where you tried to do the cast?

from workflow-core.

germandb avatar germandb commented on July 18, 2024

Hi Daniel your past solution was correct, I was loading the workflow from a Dll and didn't realize that the proyect with that dll wasn't compiling in the solution. So I was using and old definition of the Workflow.

Thanks for your time.

from workflow-core.

bautigaraventa avatar bautigaraventa commented on July 18, 2024

Hi, How could I achieve multiple Outputs in the EventData when I want to load my workflow by JSON? I don't know how to do the "cast", I mean this:
(step.EventData as MyDataClass).StrValue2

from workflow-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.