C# 在工作流中保存自定义表单项
我当前遇到一个问题,在将自定义表单内容项保存为提交之前,我试图在工作流中进行检查。一旦点击CreateAndPublish工作流,它实际上会创建项,但字段值没有正确保存 以下是我的工作流程:C# 在工作流中保存自定义表单项,c#,asp.net,orchardcms,C#,Asp.net,Orchardcms,我当前遇到一个问题,在将自定义表单内容项保存为提交之前,我试图在工作流中进行检查。一旦点击CreateAndPublish工作流,它实际上会创建项,但字段值没有正确保存 以下是我的工作流程: public class CreateAndPublishActivity : Task { private readonly IContentManager _contentManager; public CreateAndPublishActivity(IContentMana
public class CreateAndPublishActivity : Task {
private readonly IContentManager _contentManager;
public CreateAndPublishActivity(IContentManager contentManager) {
_contentManager = contentManager;
}
public Localizer T { get; set; }
public override bool CanExecute(WorkflowContext workflowContext, ActivityContext activityContext) {
return true;
}
public override IEnumerable<LocalizedString> GetPossibleOutcomes(WorkflowContext workflowContext, ActivityContext activityContext) {
return new[] { T("Done") };
}
public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
_contentManager.Create(workflowContext.Content.ContentItem, VersionOptions.Published);
yield return T("Done");
}
public override string Name {
get { return "CreateAndPublish"; }
}
public override LocalizedString Category {
get { return T("Content Items"); }
}
public override LocalizedString Description {
get { return T("Create and Publish the content item."); }
}
}
public类CreateAndPublishActivity:任务{
私有只读IContentManager\u contentManager;
public CreateAndPublishActivity(IContentManager contentManager){
_contentManager=contentManager;
}
公共定位器T{get;set;}
公共覆盖布尔CanExecute(WorkflowContext WorkflowContext,ActivityContext ActivityContext){
返回true;
}
公共重写IEnumerable GetPossibleOutcomes(WorkflowContext WorkflowContext,ActivityContext ActivityContext){
返回新的[]{T(“完成”)};
}
公共重写IEnumerable执行(WorkflowContext WorkflowContext,ActivityContext ActivityContext){
_创建(workflowContext.Content.ContentItem,VersionOptions.Published);
收益率回报T(“完成”);
}
公共重写字符串名{
获取{return“CreateAndPublish”;}
}
公共覆盖本地化字符串类别{
获取{return T(“内容项”);}
}
公共覆盖本地化字符串描述{
获取{return T(“创建并发布内容项”);}
}
}
内容项显示在“提交”下,但没有字段值