In WF 4.0 all the activities are derived from Base activity called Activity . In this blog post i am going to create custom AsyncCodeActivity.
AsyncCodeActivity and AsyncCodeActivity<T> are very similar to the CodeActivity. But AsyncCodeActivity execute Asynchronously and perform long running operations. suppose if you wanted to perform I/O or downloading any content from Web, you should create activity which drives from the AsyncCodeActivity or NativeActivity.
Here i am going to build Custom AsyncCodeActivity to retrieve HTML content for the given URL .
C# implementation of Custom AsyncCodeActivity Source Lines.
To Add Custom Activity Designer to this Activity please refer http://mstecharchitect.blogspot.com/2010/02/wf-40-custom-activity-designer.html. Now we need to test it.
Here I have a List of Web URLs which i need to download the content (HTML) and save into a file . To loop through the all URL collections and pass into custom activity I am going use ParallelForEach<T> Activity.
Now Build the WF as Shown Below and Test it.
Nandri(Thanks)
SreenivasaRagavan.
2 comments:
Good post. Thanks for sharing.
Post a Comment