Click here to Skip to main content
15,885,757 members
Articles / Programming Languages / C#

Microsoft Windows Workflow Foundation

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
31 Aug 2009CPOL12 min read 74.3K   1.6K   52  
An artilce that explains how to call external data and methods.
using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.Activities;
using System.Workflow.Runtime;
using System.Data;

namespace MVDataService
{
    public sealed class MVDataConnector : IMVDataService 
    {
        private DataSet _dataValue = null;
        private static WorkflowMVDataService _service = null;
        private static object _syncLock = new object();

        public static WorkflowMVDataService MVDataService
        {
            get { return _service; }
            set
            {
                if (value != null)
                {
                    lock (_syncLock)
                    {
                        // Re-verify the service isn't null
                        // now that we're locked...
                        if (value != null)
                        {
                            _service = value;
                        } // if
                        else
                        {
                            throw new InvalidOperationException("You must provide a service instance.");
                        } // else
                    } // lock
                } // if
                else
                {
                    throw new InvalidOperationException("You must provide a service instance.");
                } // else
            }
        }

        public DataSet MVData
        {
            get { return _dataValue; }
        }

        // Workflow to host communication method
        public void MVDataUpdate(DataSet mvData)
        {
            // Assign the field for later recall
            _dataValue = mvData;

            // Raise the event to trigger host read
            _service.RaiseMVDataUpdateEvent();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Monroe Community
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions