WF4.0:RC相对于Beta2的变化

1、RC中的FlowChart使用FlowSwitch<T>代替了FlowSwitch

描述:在Beta2中,活动工具栏上的FlowSwitch将生成一个非泛型FlowSwitch,在RC中生成泛型FlowSwitch<T>,修改的理由是非泛型FlowSwitch只允许string类型的switch,FlowSwitch<T> 允许任何类型的switch。

用户影响:在Beta2或者更早的版本WF设计器中使用了FlowSwitch创建的Flowchart,将不能在beta2之后的WF设计器中加载。

缓解:在Beta2 中如果你在Flowchart工作流中已经使用了FlowSwitch ,你需要手动的编辑flowchart的XAML,添加 x:TypeArguments="x:String"到FlowSwitch 节点,如下面代码段Beta2:

代码
<FlowSwitch Default="{x:Reference __ReferenceID2}" x:Name="__ReferenceID3" Expression="[variable1]">

  
<x:Reference>__ReferenceID0<x:Key>Ray</x:Key></x:Reference>

  
<x:Reference>__ReferenceID1<x:Key>Bill</x:Key></x:Reference>

</FlowSwitch>

RC:

代码
<FlowSwitch x:TypeArguments="x:String" Default="{x:Reference __ReferenceID2}" x:Name="__ReferenceID3" Expression="[variable1]">

  
<x:Reference>__ReferenceID0<x:Key>Ray</x:Key></x:Reference>

  
<x:Reference>__ReferenceID1<x:Key>Bill</x:Key></x:Reference>

</FlowSwitch>

2、Literal <T>表达式中的引用的类型

描述:在WF中Literal表达式使用Literal<T>活动表示,在Beta2 中任何类型都能使用这个表达式。在RC中使用引用类型的实例初始化Literal<T> 是无效的。String是唯一的例外。 做这种改变的动机是用户错误的认为使用新的引用类型创建一个Literal<T> 要为每一个工作流实例创建新的引用类型。不允许“Literal”使用引用类型消除这种混乱。在Beta2以下定义的工作流将跑不出错误。 在RC它将收到一个检验错误:

'Literal<List<String>>': Literal only supports value types and the immutable type System.String.  The type System.Collections.Generic.List`1[System.String] cannot be used as a literal.

 

代码
List<string> names = new List<string> {"Frank""Joe""Bob" };

 

Variable
<List<string>> nameVar = new Variable<List<string>> { Default = new Literal<List<string>>(names)};            

//Note: the following is the equivalent to the line above, the implicit cast creates a Literal<T> expression

//Variable<List<string>> nameVar = new Variable<List<string>> { Default = names };

 

DelegateInArgument
<string> name = new DelegateInArgument<string>();

Activity program 
= new Sequence

{

    Variables 
= { nameVar },

    Activities 
=

    {

        
new AddToCollection<string> { 

            Collection 
= new InArgument<ICollection<string>>(nameVar), 

            Item 
= new InArgument<string>("Jim")},

        
new ForEach<string>

            Values 
= new InArgument<IEnumerable<string>>(nameVar), 

            Body 
= new ActivityAction<string>

                Argument 
= name, 

                Handler 
= new WriteLine { Text = new InArgument<string>(name)}}}

    }

};

用户影响:已经在Literal<T>中使用引用类型的客户需要使用另外一种不同类型表达式将引用类型放在工作流中使用。例如VisualBasicValue<T> 和LambdaValue<T>

代码
Variable<List<string>> nameVar = new Variable<List<string>>

    Default 
= new VisualBasicValue<List<string>>("New List(Of String)(New String() {\"Frank\", \"Joe\", \"Bob\"})")};

DelegateInArgument
<string> name = new DelegateInArgument<string>();



Activity program 
=  new Sequence

{

    Variables 
= { nameVar },

    Activities 
=

    {

        
new AddToCollection<string> { 

            Collection 
= new InArgument<ICollection<string>>(nameVar), 

            Item 
= new InArgument<string>("Jim")},

        
new ForEach<string>

            Values 
= new InArgument<IEnumerable<string>>(nameVar), 

            Body 
= new ActivityAction<string>

                Argument 
= name, 

                Handler 
= new WriteLine { Text = new InArgument<string>(name)}}}

    }

};

3、TrackingRecord API中EventTime属性类型的变化

描述:在 Beta2中,在 System.Activities.Tracking.TrackingRecord 里面的EventTime 属性是System.DateTimeOffset类型,Beta2 以后的版本类型改变成System.DateTime,在TrackingRecord发行时,EventTime属性以UTC存储时间。

public abstract class TrackingRecord {
              …
             
public System.DateTime EventTime { get; }
             …
}

用户影响:用户如果已经创建一个使用TrackingRecord对象自定义的参与者,访问EventTime属性时需要更改类型,如果在执行跟踪参与者的逻辑是从TrackingRecord指派EventTime属性的,分配这个属性的地方将获得一个DateTime类型而不是DateTimeOffset。

4、新的持久化影响:

描述:由于在实例模式和逻辑的巨大变化,从Beta 2到RC迁移持久化数据是不可能

用户影响: 为了从RC升级到Beta2,放弃现有所有的实例并重新提交数据。另外,需要在不同的物理或虚拟机上安装RC,不能安装在使用过Beta 2的,而且需要设置一个不同的持久化数据库。

 

5、总结

WF4.0 RC 对 Beta2 的变化很小

参考文章:http://blogs.msdn.com/endpoint/archive/2010/02/10/4-0-beta2-rc-wcf-wf-breaking-changes.aspx

 



(全文完)


以下为广告部分

您部署的HTTPS网站安全吗?

如果您想看下您的网站HTTPS部署的是否安全,花1分钟时间来 myssl.com 检测以下吧。让您的HTTPS网站变得更安全!

SSL检测评估

快速了解HTTPS网站安全情况。

安全评级(A+、A、A-...)、行业合规检测、证书信息查看、证书链信息以及补完、服务器套件信息、证书兼容性检测等。

SSL证书工具

安装部署SSL证书变得更方便。

SSL证书内容查看、SSL证书格式转换、CSR在线生成、SSL私钥加解密、CAA检测等。

SSL漏洞检测

让服务器远离SSL证书漏洞侵扰

TLS ROBOT漏洞检测、心血漏洞检测、FREAK Attack漏洞检测、SSL Poodle漏洞检测、CCS注入漏洞检测。

posted @ 2010-02-20 10:25  麒麟  阅读(2003)  评论(2编辑  收藏  举报