我有一个外部活动,它有一个主体,您可以将其他活动拖到上面。然后我有几个内部活动,它们必须是外部活动的后代。我想添加设计时验证以确保内部放置在外部内。
我听说我“可以在验证步骤中使用 System.Activities.Validation.GetParentChain 枚举活动的所有父项”。但即使在阅读了该类的文档之后,我也不知道如何使用它。
我想我在内部类的 CacheMetadata 中使用它。我想使用 foreach(varparents inparentChain) { ... } ,并确保至少一个祖先是 Outer 类型。不知道该怎么做。
谁能解释如何在设计时验证内部活动是外部活动的后代?
我刚刚开始学习 Windows 工作流,并且正在阅读有关该主题的书籍。我已经看到了一些对称为工作流服务的东西的引用。例如,模型服务就是其中之一。我还没有看到关于这些服务究竟是什么的很好的解释。有人可以帮我弄这个吗?
我正在学习Windows Workflow Foundation 4,并尝试创建以下程序:
using System;
using System.Activities.XamlIntegration;
using System.Linq;
using System.Activities;
using System.Activities.Statements;
using System.Reflection;
using System.Xaml;
namespace BranchedActivities
{
class Program
{
static void Main(string[] args)
{
Activity wf = ActivityXamlServices.Load(@"C:\...\Workflow1.xaml");
WorkflowInvoker.Invoke(wf);
Console.ReadKey();
}
}
}
Run Code Online (Sandbox Code Playgroud)
Workflow1包含一个单独的动作,称为Activity1。Activity1.xaml由单个Writeline组成。
当我将工作流作为已编译的Activity加载时(通过使用“ Activity wf = new Workflow1()”),程序将完美加载。当我尝试为活动加载XAML时(如上面的代码),出现异常:无法创建未知类型'{clr-namespace:} Activity1'。
我想我也必须以某种方式加载其他xaml文件,尽管我对此非常困惑。
供您参考。...Workflow1.xaml:
<Activity mc:Ignorable="sap" x:Class="Workflow1" sap:VirtualizedContainerService.HintSize="262,240" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:">
<Sequence …Run Code Online (Sandbox Code Playgroud) 我花了很多时间试图学习WF4(当谈到WF时我总是n00b),但我似乎无法找到任何我正在尝试的例子:
我需要在运行时制作一个WF4(C#)规则,将其保存到数据库(当前是SQL,但这对我来说并不重要),加载规则并在运行时执行它.
下面的两个示例表明这应该是(在运行时加载和执行规则)应该是可能的:
http://www.nilzorblog.com/2011/11/using-wf4-as-rule-engine.html
http://msdn.microsoft.com/en-us/library/vstudio/ee960221(v=vs.100).aspx
我有两个独立工作的例子没有问题.
但是,当我尝试组合这些示例时(这应该很简单?)我经常遇到大量的转换错误,如下所示:
参数2:无法从'System.Collections.Generic.List <SharedLibrary.AssignmentRule>'转换为'System.Collections.Generic.List <ExternalRuleSetLibrary.RuleSetData>'
我已经搜索了好几天的例子来做这件事,但没有找到任何东西.这就是为什么我在这里问大师:)提前谢谢你!
您是否可以提供如何在运行时制作WF4规则,将其保存到数据库,加载规则并在运行时执行它的示例或配方?
I have an Activity where I declared a InArgument without a type (because I want to know the type of the Expression at design time).
When I execute the activity I get this error in var contentTelegram line:
"The argument of type '<type>' cannot be used. Make sure that it is declared on an activity."
Run Code Online (Sandbox Code Playgroud)
Here is my code:
public InArgument Content { get; set; }
protected override PlcMessage Execute(CodeActivityContext context)
{
try
{
var contentTelegram = Content.Get(context);
return new …Run Code Online (Sandbox Code Playgroud) 我正在尝试调试动态加载的工作流程。为此,我基本上实施了以下步骤:
var currentWorkflow = ActivityXamlServices.Load(@"d:\test.xaml");
var wfApp = new WorkflowApplication(currentWorkflow, anyInputs);
wfApp.Run();
Run Code Online (Sandbox Code Playgroud)
现在我想逐步调试工作流的活动 - 如果可能的话在工作流设计器中。在 MSDN 中我找到了一篇文章如何在调试菜单上的工作流程中设置断点,
在“调试”菜单上,选择“新建断点”。
单击“在函数处中断”。“新建断点”对话框打开。
使用以下语法在“函数”文本框中指定活动的名称:QualifiedActivityId[:[FullClassName][:InstanceId]]。
...
但我不知道如何在“函数”文本框中指定活动的名称以及如何获取 QualifiedActivityId。
谁能举个例子吗?
另一个问题是,我在松散的 xaml 中有许多自定义活动,这些活动在设计器中以红色框显示,并带有以下消息:“由于 XAML 中的错误,无法加载活动”。有没有办法加载相关程序集,以便 VS2010 可以显示具有自定义活动的松散 xaml?
c# debugging visual-studio-2010 workflow-foundation workflow-foundation-4
我在机器配置中注册了一个名为'ApplicationServerWorkflowInstanceStoreConnectionString的连接字符串(机器配置的32位和64位版本).但是,即使IIS管理器看到它(在特定Web应用程序的节连接字符串中),应用程序也看不到它.我究竟做错了什么?

安琪莉.
我有一个工作流服务。我还在该服务中使用了工作流持久性。但是在 IIS 中部署工作流后,我从客户端向服务器上的日志文件中的工作流服务发出请求。我看到一条消息
The execution of the InstancePersistenceCommand named {urn:schemas-microsoft-com:System.Activities.Persistence/command}SaveWorkflow was interrupted by an error.InnerException Message: Type 'System.ServiceModel.Channels.ReceivedFault' cannot be serialized.
Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
Run Code Online (Sandbox Code Playgroud)
我尝试了有关此异常的研究,但没有发现任何内容。
如何解决这个问题?或者让我知道上述异常的原因是什么?
我正在尝试将Windows工作流程作为Web服务托管,下面是我构建的示例工作流程,并希望作为Web服务(.svc)托管,是否可以建议所需的步骤?
using System;
using System.ServiceModel.Activities;
using System.Activities;
using System.ServiceModel;
using System.Activities.Statements;
namespace DemoWF
{
public class _25_LeaveRequest
{
public WorkflowService GetInstance()
{
WorkflowService service;
Variable<int> empID = new Variable<int> { Name = "empID" };
Variable<int> requestID = new Variable<int> { Name = "requestID" };
Receive receiveLeaveRequest = new Receive
{
ServiceContractName = "ILeaveRequestService",
OperationName = "ApplyLeave",
CanCreateInstance = true,
Content = new ReceiveParametersContent
{
Parameters ={
{"empID",new OutArgument<int>(empID)}
}
}
};
SendReply replyLeaveRequestID = new SendReply
{
Request = receiveLeaveRequest, …Run Code Online (Sandbox Code Playgroud) workflow workflow-foundation workflow-foundation-4 sharepoint-workflow window-functions
我在WPF项目中使用了Relay Commands,但我目前正在使用Windows Workflows,而我正在使用自己的设计器进行自定义活动.如果按下,我想在我的设计上添加一个按钮来添加新字段.我花了几天时间在互联网上搜索,但似乎Windows工作流程已经打败了我.这就是我所拥有的,它不起作用,如果有人知道为什么请帮助.
[Designer(typeof(MyCustomActivityDesigner))]
public sealed class MyCustomActivity : AsyncCodeActivity
{
public MyCustomActivity()
{
AddSpecificParameter = new DelegateCommand(AddParameter);
}
public DelegateCommand AddSpecificParameter { get; set; }
public void AddParameter()
{
//add value to an obervable collection
}
}
Run Code Online (Sandbox Code Playgroud)
中继命令实现:
public class DelegateCommand :ICommand
{
//Parameterless constructor needed as windows workflow serialises it
public DelegateCommand()
{ }
private readonly Action _action;
public DelegateCommand(Action action)
{
_action = action;
}
public void Execute(object parameter)
{
_action();
}
public bool CanExecute(object …Run Code Online (Sandbox Code Playgroud)