摘要: 1. 把单独的WF(4.0.2)项目属性设置为“类库”,XAML属性设置为图1所示:图1 XAML文件属性设置2.修改生成的XAML中自定义Activity对应的namespace和assembly:原始代码:xmlns:local="clr-namespace:TestStateMachines"改为:xmlns:local="clr-namespace:TestStateMachines;assembly=TestStateMachines"3. 生成dll,在WCF中引用dll。加载XAML前要设置XamlXmlReaderSettings,本例中 阅读全文
posted @ 2012-08-09 16:46 wyking 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Add project references to System.Activities.DurableInstancing andSystem.Runtime.DurableInstancing. Open the Program.cs file and alter thecode to: 1 class Program { 2 static SqlWorkflowInstanceStore sqlWorkflowInstanceStore =SetupSqlPersistenceStore(); 3 static void Main(string[] args) { 4 StartAndUn 阅读全文
posted @ 2012-08-05 21:19 wyking 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 1 using System.Activities.DurableInstancing; 2 using System.Threading; 3 using System.Activities; 4 namespace ConfiguringSqlPersistenceStore { 5 class Program { 6 static void Main(string[] args) { 7 //setup sql persistence store 8 string sqlPersistenceDBConnectionString= 9 @"Data Source=.\sqlex 阅读全文
posted @ 2012-08-05 21:08 wyking 阅读(797) 评论(0) 推荐(0) 编辑
摘要: 静态函数的第一个参数前面有this 关键字:namespace ExtensionMethods{ public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } } }可使用以下 using 指令将 WordCount 扩展方法放入范围中:using Ext 阅读全文
posted @ 2012-08-03 13:03 wyking 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 在使用静态构造函数的时候应该注意几点: 1、静态构造函数既没有访问修饰符,也没有参数。 --因为是.NET调用的,所以像public和private等修饰符就没有意义了。 2、在创建第一个类实例或任何静态成员被引用时,.NET将自动调用静态构造函数来初始化类。 --也就是说我们无法直接调用静态构造函数,也不可能知道静态构造函数何时会被调用。 3、一个类只能有一个静态构造函数。 4、无参数的构造函数可以与静态构造函数共存。 --尽管参数列表相同,但一个属于类,一个属于实例,所以不会冲突。 5、最多只运行一次。 6、静态构造函数不可以被继承。 7、如果没有写静态构造函数,... 阅读全文
posted @ 2012-08-03 12:54 wyking 阅读(121) 评论(0) 推荐(0) 编辑