Orchard core 用工作流创建内容项目(ContentItem)

参考文档中的代码:https://docs.orchardcore.net/en/dev/docs/reference/modules/Workflows/

注意:可转发此博客,但必须表示原作者。

1.创建一个模块。

2.在模块中创建几个文件夹同上面图中的文件夹一样。

3.在Activities文件夹中创建CreateEvaluationTask.cs:

using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Localization;
using Onon.Workflow.Notify;
using OrchardCore.ContentFields.Fields;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Records;
using OrchardCore.DisplayManagement.Notify;
using OrchardCore.Lists.Models;
using OrchardCore.Media.Fields;
using OrchardCore.Workflows.Abstractions.Models;
using OrchardCore.Workflows.Activities;
using OrchardCore.Workflows.Models;
using OrchardCore.Workflows.Services;
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using YesSql;

namespace Onon.Workflow.Activities
{
    public class CreateEvaluationTask : TaskActivity
    {
        private readonly INotifier _notifier;
        private readonly IStringLocalizer S;
        private readonly IHtmlLocalizer H;
        private readonly IWorkflowExpressionEvaluator _expressionEvaluator;
        private readonly HtmlEncoder _htmlEncoder;
        private readonly IContentManager _contentManager;
        private readonly ISession _session;

        public CreateEvaluationTask(INotifier notifier, IStringLocalizer<CreateEvaluationTask> s, IHtmlLocalizer<CreateEvaluationTask> h, IWorkflowExpressionEvaluator expressionEvaluator, HtmlEncoder htmlEncoder, IContentManager contentManager, ISession session)
        {
            _notifier = notifier;
            S = s;
            H = h;
            _expressionEvaluator = expressionEvaluator;
            _htmlEncoder = htmlEncoder;
            _contentManager = contentManager;
            _session = session;
        }

        // The technical name of the activity. Activities on a workflow definition reference this name.
        public override string Name => nameof(CreateEvaluationTask);

        // The displayed name of the activity, so it can use localization.
        public override LocalizedString DisplayText => S["创建评价内容"];

        // The category to which this activity belongs. The activity picker groups activities by this category.
        public override LocalizedString Category => S["UI"];

        // A description of this activity's purpose. 
        //public override LocalizedString Description => S["Display a message.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值