基于HandleExternalEventActivity的自定义活动
我将 HandleExternalEventActivity
与 Roles
属性一起使用,我需要检查我的 custom bool RoleProfile.IsDelegatee(string userName, stringworkflowName , string ActivityName, string eventName, string roleName)
方法找到匹配项。 (“我正在度假;UserX 应该能够代表我批准‘任务 X’,但不能批准‘任务 Y’”)
我尝试继承 HandleExternalEventActivity
但 Execute
方法被标记为密封。
你有什么想法?
TIA
I'm using HandleExternalEventActivity
with Roles
property and I need to check if my custom bool RoleProfile.IsDelegatee(string userName, string workflowName, string activityName, string eventName, string roleName)
method finds a match. ("I'm on vacation; UserX should be able to approve 'task X' on my behalf, but not 'task Y'")
I tried to inherit HandleExternalEventActivity
but Execute
method was marked as sealed.
Do you have any ideas?
TIA
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 HandleExternalEventActivity 不允许您执行此操作,它允许您验证的内容受到限制。 但是,ReceiveActivity 有一个 OperationValidation 事件,可让您在代码中执行所需的任何操作,并在 OperationValidationEventArgs 上设置 IsValid 属性以指示是否允许调用。
如果您不愿意或无法采用 WCF 路线,最好的选择是创建一个对排队消息做出反应的自定义活动。 HandleExternalEventActivity 只是工作流排队系统的一个非常薄的包装,我几乎总是建议人们采用自定义活动路线而不是 HandleExternalEventActivity 路线,因为它更加灵活并且通常更易于使用。
I don't think the HandleExternalEventActivity lets you do this, it's limited in what it will let you validate. However the ReceiveActivity has a OperationValidation event that lets you do whatever you want in code and set an IsValid property on the OperationValidationEventArgs to indicate if the call is allowed or not.
If you are not willing or able to go the WCF route the best option is to create a custom activity that reacts to queued messages. The HandleExternalEventActivity is only a very thin wrapper over the workflow queuing system and I nearly always advise people to go the custom activity route instead of the HandleExternalEventActivity route as it is far more flexible and often even easier to use.