我试图在新租户的设置中访问属于默认租户的事件工作流程。
所以在SetupService(Orchard.Setup)中我正在调用shell:
var shellContext = _orchardHost.GetShellContext(_shellSettingsManager.LoadSettings().Where(x => x.Name == "Default").FirstOrDefault());
using (var _environment = shellContext.LifetimeScope.Resolve<IWorkContextAccessor>().CreateWorkContextScope())
{
var Subscriber = environment.Resolve<ISetupCompletEventHandler>();
Subscriber.SetupCompleted(new TenantContext
{
Name = context.SiteName,
Email = context.SiteEmail,
user = user
});
}
我的活动:
public class WorkflowSetupEventHandler : ISetupCompletEventHandler
{
private readonly IWorkflowManager _workflowManager;
public WorkflowSetupEventHandler(IWorkflowManager workflowManager)
{
_workflowManager = workflowManager;
}
public void SetupCompleted(TenantContext context)
{
_workflowManager.TriggerEvent("SetupCompleted",
context.user,
() => new Dictionary<string, object> {
{"Email", context.Email},
{"Name", context.Name}
});
}
}
由于某种原因,从未触发过SetupCompleted。
我错过了什么吗?谢谢
答案 0 :(得分:0)
问题是我试图获取默认租户,而“默认”租户不存在,但他的状态不是running
上的shellsettings