Windows Workflow Foundation 3


Programmatically setting a SetStateActivity


Hi,I need to set state programmatically in WF and referred to this blog sample : Re: Writing an enhanced SetState activityhttp://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1375501&SiteID=1When I modeled my code along the lines in this post, it throws an exception informing me that the object service in :protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)        {            SetStateService service = executionContext.GetService<SetStateService>();            service.SetState(TargetState);            return ActivityExecutionStatus.Closed;        }has not been set to a reference (service remains null)I am not familiar with the ActivityExecutionStatus block and am not sure where I need to set the reference.Could someone please tell me what I am doing wrong?ThanksRahul
Did you add your custom "SetStateService" to the runtime?
Code Snippet
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
workflowRuntime.AddService(new SetStateService());
workflowRuntime.StartRuntime();
 
 
Did you add your custom "SetStateService" to the runtime?
Code Snippet
WorkflowRuntime workflowRuntime = new WorkflowRuntime();
workflowRuntime.AddService(new SetStateService());
workflowRuntime.StartRuntime();
 
 
Thanks,I was missing thatRahul

Related Links

Runtime change in workflow
Beta2 Workflow Error
Changing which workflow items are available when modifying at runtime
ExpenseReport Sample Cancle Approval Question
Problem with sendmail Activity
Global Run Time Variable
To use dependency properties or not
OwnershipTimeoutSeconds
Problem in WorkflowRuntime.WorkflowCompleted event
HandleExternalEvent Problem
WWF with .NET compact framework 2.0
How can I query StateMachineWorkflowInstance before the WF idles
Question about modifying a workflow
Rule Conditions against custom activities and XAML activation - how should I achieve this?
MOSS Publishing Site
WF custom persistence once again

Categories

MSDN
Windows and Windows ph...
Microsoft Research
Bing Maps
Open Specifications
Lync Server
Other Forums
Archived Forums SN-SZ
Internet of Things
Virtualization
Microsoft R
MSDN and TechNet Profi...
Visual F#
Visual Studio Setup an...
Visual Studio Graphics...
Submitting and Publish...
Windows Desktop Develo...
Windows Desktop Web Se...
Development with the W...
Hardware Development B...
SharePoint 2013 - Usin...
SharePoint 2010 - Gene...
SharePoint 2010 - Usin...
Azure Active Directory
Microsoft Azure Site R...
Azure Scripting and Co...
Language Understanding...
Common Language Runtim...
BizTalk Server EDI and...
BizTalk Server RFID
Commerce Server 2007
XML, System.Xml, MSXML...
Partnering with Microsoft
Windows Mobile Develop...
SQL Server Notificatio...
Database Mirroring
SQL Server Data Wareho...
Microsoft StreamInsight
SQL Server Application...
SQL Server PowerPivot ...
Standard 2009: Embedde...
SQL Server 2012 Spatia...
SQL Server 2012 Analys...
MSDN and TechNet Searc...
Script Junkie Discussion
App Linking
WebsitePanel - Enterpr...
Developing for the Mob...
The Samsung Windows De...
Silverlight Installati...
Report a Silverlight Bug
.NET Platform Architec...
ADO.NET Entity Framewo...
Announcements about pr...
Audio API and Programm...
AppFabric Caching
Developer Documentatio...
Doloto
Dynamic Languages on .NET
HD DVD Interactivity A...
LINQ to SQL (Pre-Release)
LightSwitch HTML Clien...
Managed Extensibility ...
Popfly Bugs and Sugges...
Project Codename:  Jasper
Parallel Programming w...
Search Server: Develop...
Silverlight (formerly ...
Small Business Applica...
SQL Server Modeling
SQL Creation
SQL Server 2014 Data Q...
SQL Server 2014 Setup ...
SQL Server 2014 In-Mem...
Visual Basic IDE
Visual C# Express 2008...
Visual C# IDE
Visual Studio WPF/SL D...
Microsoft Graph

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile