[IronPython] Problem between Iron Python and Windows Workflow Foundation WWF

Mohammed Hossam bashmohandes at gmail.com
Tue May 9 20:41:08 CEST 2006


I've tried to use Iron Python with WWF, but it seems that there is a problem
when passing inputs of type System.Type in some API's like
WorkflowRuntime.CreateWorkflow
that takes a System.Type input of a type that supposed to be inheriting from
one of WWF activity classes like SequentialWorkflowActivity
this is the code i wrote

import clr
clr.AddReference("System.Workflow.Runtime")
clr.AddReference("System.Workflow.ComponentModel")
clr.AddReference("System.Workflow.Activities")
from System.Workflow.Activities import *
from System.Workflow.Runtime import *
from System.Workflow.Activities import *

class MyWorkflow(SequentialWorkflowActivity):
    def __init__(self):
        SequentialWorkflowActivity.__init__(self)
        self.codeActivity = CodeActivity()
        self.codeActivity.ExecuteCode += self.SayHello
        self.codeActivity.Name = "Hello"
        self.Activities.Add(self.codeActivity)

    def SayHello(sender, args):
        print "Hello"



def Started(sender, args):
    print "Started\n"


def Completed(sender, args):
    print "Completed"


tf = MyWorkflow()

rt = WorkflowRuntime()
rt.WorkflowStarted += Started
rt.WorkflowCompleted += Completed
instance = rt.CreateWorkflow(tf.GetType())
instance.Start()

and this was the error
Traceback (most recent call last):
  File , line 0, in input##0
  File , line 0, in __import__##4
  File  workflow.py, line 35, in Initialize
  File , line 0, in CreateWorkflow##17
  File System.Workflow.Runtime, line unknown, in CreateWorkflow
  File System.Workflow.Runtime, line unknown, in InternalCreateWorkflow
  File System.Workflow.Runtime, line unknown, in GetWorkflowExecutor
  File System.Workflow.Runtime, line unknown, in Load
  File System.Workflow.Runtime, line unknown, in InitializeExecutor
  File System.Workflow.Runtime, line unknown, in GetRootActivity
  File System.Workflow.Runtime, line unknown, in LoadRootActivity
  File System.Workflow.Runtime, line unknown, in CreateInstance
*ValueError: The input workflow type must define a public, parameterless
constructor.

so please if you know a way arround please tell me

Thanks in advance
*--
=-=-=-=-=-=-=-=-=-=-=-=
Mohammed Hossam Eldin
bashmohandes at gmail.com
mobile: +2012 3818978
www.SilverKey.us
Personal Blogs
http://spaces.msn.com/bashmohandes
Technical Blogs
http://spellcoder.com/blogs/bashmohandes
=-=-=-=-=-=-=-=-=-=-=-=-=
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20060509/38395020/attachment.html>


More information about the Ironpython-users mailing list