workflow-foundation-4

Scheduling child activity that implements an interface with input parameters

泄露秘密 提交于 2019-12-10 17:26:29
问题 public sealed class Parent : NativeActivity { public Parent() { Childrens = new Collection<Activity>(); Variables = new Collection<Variable>(); _currentActivityIndex = new Variable<int>(); CurrentCustomTypeInstance= new Variable<MyCustomType>(); } [Browsable(false)] public Collection<Activity> Childrens { get; set; } protected override void Execute(NativeActivityContext context) { _currentActivityIndex.Set(context, 0); context.ScheduleActivity(FirstActivity, Callback); } private void Callback

Switch of string in Workflow Foundation issue

喜你入骨 提交于 2019-12-10 13:26:57
问题 I've encountered a very weird problem with WF4: when I use Switch activity and make the decision on the value of a string variable somehow WF treats argument to the Switch as a string, not the name of the variable. And consequently I get incorrect results. Steps to repro: - create new WF - add Sequence - add Switch of String to the Sequence - add a new string variable named, for instance, [testText] and set its default value to "test" - set argument of the switch to testText - create a case

InstanceLockedException: How to handle locking issues with WF 4.0?

岁酱吖の 提交于 2019-12-10 12:13:50
问题 Background: I'm using WF 4.0. My web app and workflow are running on a farm (4 machines). All references from web app to workflow use "http://localhost/..". Workflow persistance is kept on one database using SQL Server 2005. Running on Windows Server 2008. Scenario: ServerA creates new workflow and processing completes when it reaches a Pick Activity which contains Receive Activities as its branches. Just before the Pick activity, an app-specific flag is set in the database to indicate that

Solution for “XamlInjector–Cannot create unknown type errors” does not work

孤人 提交于 2019-12-10 11:46:44
问题 In unit test, i passed the assembly of Custom Activity to the ctor as the local assembly var xamlInjector = new XamlInjector("CreditAtRenewalFlow.xaml", typeof(CreateFollowUp).Assembly); CreateFollowUp is a AsynCodeActivity I got error "'Unexpected 'PROPERTYELEMENT' in parse rule 'Element ::= . EmptyElement | ( StartElement ElementBody ).'.' Line number '2' and line position '4'." at execution of the following line var host = WorkflowInvokerTest.Create(xamlInjector.GetActivity()); The sample

How to write a long running activity to call web services in WF 4.0

蹲街弑〆低调 提交于 2019-12-10 11:31:31
问题 I created an activity which executes a web request and stores the result into the database. I found out that for these long running activities I should write some different code so that the workflow engine thread won't be blocked. public sealed class WebSaveActivity : NativeActivity { protected override void Execute(NativeActivityContext context) { GetAndSave(); // This takes 1 hour to accomplish. } } How should I rewrite this activity to meet the requirements for a long running activity 回答1:

Registering custom tracking participants through code in workflow foundation 4.0

…衆ロ難τιáo~ 提交于 2019-12-10 11:21:28
问题 I'm having trouble trying to attach a custom tracking participant in workflow foundation 4.0. I have a class that inherits from TrackingParticipant but I cannot see any other way of attaching it to my WorkflowServiceHost other than through lots of messy app.config entries like the SDK example demonstrates below (in the system.servicemodel element). This option seems to require a lot of extra overhead and classes to be created, when I just want a simple custom tracking participant to listen to

Tracing in WF4 doesn't work?

主宰稳场 提交于 2019-12-10 11:11:17
问题 I'm trying to set up a simple test case of pushing to a TraceListener in WF4. I've created an empty wcf service library app (just the default get/reply xamlx) and added the below to the config. I get no logging back. Is there something else required? <system.diagnostics> <sources> <source name="System.Workflow"> <listeners> <add name="System.Workflow" /> </listeners> </source> <source name="System.Workflow.Runtime"> <listeners> <add name="System.Workflow" /> </listeners> </source> <source

Setting internal properties in composite WF4 Activities at design time

扶醉桌前 提交于 2019-12-10 09:56:30
问题 I want to create a composite Windows Workflow Activity (under .NET 4) that contains a predefined ReceiveAndSendReply Activity. Some of the properties are predefined, but others (particularly ServiceContractName) need to be set in the designer. I could implement this as an Activity Template (the same way ReceiveAndSendReply is implemented), but would rather not. If I later change the template, I'd have to update all previously created workflows manually. A template would also permit other

How can I write a custom WorkFlow 4 Code Activity that includes a “Body Block”?

十年热恋 提交于 2019-12-10 09:43:37
问题 Is this possible? I know it is for MS since they have WF activity packs but I'm not sure how it's done. It would be nice to be able to have Activities with Body blocks to insert other activities, buttons, etc. If not too much trouble and/or time consuming that is. 回答1: Its easy enough if you follow a few rules. Here's an example of a NativeActivity that has a child: [Designer(typeof(MyActivityDesigner)), ContentProperty("Child")] public sealed class MyActivity : NativeActivity,

Activity cannot set a Variable defined within its scope?

本小妞迷上赌 提交于 2019-12-10 09:41:46
问题 This one is making me scratch my head, and I'm wondering if I am understanding this correctly. I'm trying to define a Variable within an Activity that can be used by child Activities. The Parent should be able to set a value in this Variable at runtime. Here's the stripped down Parent class: public sealed class Parent : NativeActivity, IActivityTemplateFactory { public Collection<Child> Children { get; private set; } private CompletionCallback<string> _cc; private Variable<int> _index; public