Example #1
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual async Task DeleteAsync(string id)
        {
            var entity = await _workflowDefinitionRepository.GetAsync(id);

            var all = await PersistenceProvider.GetAllRunnablePersistedWorkflow(entity.Id, entity.Version);

            if (all.Count() > 0)
            {
                throw new UserFriendlyException("删不了!!还有没有执行完的流程!");
            }

            if (_registry.IsRegistered(entity.Id.ToString(), entity.Version))
            {
                _registry.DeregisterWorkflow(entity.Id.ToString(), entity.Version);
            }


            await _workflowDefinitionRepository.DeleteAsync(entity);
        }