示例#1
0
        /// <summary>
        /// Attempts to retrieve a <see cref="TrackingWorkflowInstance" /> from
        /// the tracking store based upon the specified instance identifier.
        /// </summary>
        /// <param name="instanceId">
        /// The <see cref="Guid" /> of the workflow instance for which the
        /// tracking data is requested.
        /// </param>
        /// <param name="trackingWorkflowInstance">
        /// When this method returns <c>true</c>, contains a <see cref="TrackingWorkflowInstance" />
        /// that provides access to the tracking data associated with the workflow instance.
        /// This parameter is passed uninitiailized.
        /// </param>
        /// <returns>
        /// <c>true</c> if tracking data is available for the requested workflow
        /// instance, <c>false</c> otherwise.
        /// </returns>
        public Boolean TryGetWorkflow(Guid instanceId, out TrackingWorkflowInstance trackingWorkflowInstance)
        {
            using (DbCommand dbCommand = CreateCommand(_nameResolver.ResolveCommandName(TrackingCommandName.GetWorkflow), CommandType.StoredProcedure))
            {
                AddParameter(dbCommand, _nameResolver.ResolveParameterName(
                                 TrackingCommandName.GetWorkflow,
                                 TrackingParameterName.InstanceId), instanceId,
                             AdoDbType.Guid);

                AddParameter(dbCommand, _nameResolver.ResolveParameterName(
                                 TrackingCommandName.GetWorkflow,
                                 TrackingParameterName.TrackingWorkflowInstances), instanceId,
                             AdoDbType.Cursor);

                using (IDataReader dataReader = dbCommand.ExecuteReader())
                {
                    if (dataReader.Read())
                    {
                        trackingWorkflowInstance = buildTrackingWorkflowInstance(
                            dataReader, TrackingCommandName.GetWorkflow);
                    }
                    else
                    {
                        trackingWorkflowInstance = null;
                    }
                }
            }

            return(trackingWorkflowInstance != null);
        }
示例#2
0
        /// <summary>
        /// Retrieves a <see cref="TrackingWorkflowInstance" /> from the
        /// tracking store based upon the specified instance identifier.
        /// </summary>
        /// <param name="instanceId">
        /// The <see cref="Guid" /> of the workflow instance for which the
        /// tracking data is requested.
        /// </param>
        /// <returns>
        /// A <see cref="TrackingWorkflowInstance" /> containing tracking data
        /// associated with the workflow instance identifier or <c>null</c> if no
        /// data was found in the tracking store.
        /// </returns>
        public TrackingWorkflowInstance GetWorkflow(Guid instanceId)
        {
            using (ITrackingQueryResourceAccessor resourceAccessor = CreateAccessor(resourceProvider))
            {
                TrackingWorkflowInstance trackingWorkflowInstance = resourceAccessor.GetWorkflow(instanceId);
                if (trackingWorkflowInstance != null)
                {
                    trackingWorkflowInstance.QueryManager = this;
                }

                return(trackingWorkflowInstance);
            }
        }
示例#3
0
        /// <summary>
        /// Attempts to retrieve a <see cref="TrackingWorkflowInstance" /> from
        /// the tracking store based upon the specified instance identifier.
        /// </summary>
        /// <param name="instanceId">
        /// The <see cref="Guid" /> of the workflow instance for which the
        /// tracking data is requested.
        /// </param>
        /// <param name="trackingWorkflowInstance">
        /// When this method returns <c>true</c>, contains a <see cref="TrackingWorkflowInstance" />
        /// that provides access to the tracking data associated with the workflow instance.
        /// This parameter is passed uninitiailized.
        /// </param>
        /// <returns>
        /// <c>true</c> if tracking data is available for the requested workflow
        /// instance, <c>false</c> otherwise.
        /// </returns>
        public Boolean TryGetWorkflow(Guid instanceId, out TrackingWorkflowInstance trackingWorkflowInstance)
        {
            using (ITrackingQueryResourceAccessor resourceAccessor = CreateAccessor(resourceProvider))
            {
                Boolean hasTrackingData = resourceAccessor.TryGetWorkflow(instanceId, out trackingWorkflowInstance);
                if (trackingWorkflowInstance != null)
                {
                    trackingWorkflowInstance.QueryManager = this;
                }

                return(hasTrackingData);
            }
        }