BizTalk Server 2006: Using .NET Classes for Orchestration Message Types

 

BizTalk Server 2006: Using .NET Classes for Orchestration Message Types

BizTalk allows serialisable .NET classes to be used as message types in BizTalk orchestrations.   You can use tools such as XSD.exe to generate XML-Serialisable classes, or use the BinaryFormatter, or your own custom formatter, to perform serialisation and de-serialisation.

The may be benefits in some cases in using .NET classes as opposed to XSD types for BizTalk orchestration messages.   Here are some potential reasons:-

  • Allow orchestrations to directly process any message content type, including non-XML.   Converting non-XML content to XML is a more common approach (supported, for example, by the FlatFile Disassembler) but custom classes are the only viable approach in some situations.
  • 'Smart' messages.   You can build message-specific business logic into your message types.   You would typically do this as an alternative to handing off your orchestration code to external ‘helper’ code.    This approach is more object-orientated and structured.   There are lots of potential uses, including efficient message validation, cleansing, enrichment, transformation etc.   Of course, this overlaps with what you might do with maps, functoids etc., and there are some obvious pros and cons here.   Maps may be more maintainable and easier to change, but may be less efficient and, in some cases, harder to code.
  • Easier message construction.   If you are constructing messages in an orchestration, they can sometimes be easier to build than using XML.   You can implement Factory design patterns on your .NET classes for this purpose.
  • Easier to handle in the Rules Engine.   It is fundamentally easier, and generally more efficient, to assert .NET objects as facts instead of XML documents in the Microsoft BRE.   For orchestrations that make heavy use of the BRE, this can be beneficial.
  • With help, messages can be easier and more efficient to enumerate.   If your orchestration does a lot of looping through message content, then you can fairly easily build dehydration-safe enumeration into your classes (just call .MoveNext() in the 'while' condition of your loop).   However, note the following:-
    a) You generally have to enumerate variables rather than messages - i.e., first assign your message to a variable of the same .NET type.   This is because, assuming you are using XML-serialisable classes for your message types, BizTalk will use the XML Serialiser to serialise the orchestration messages, but will use the BinaryFormatter to serialise your orchestration variables.   Unless you are willing to add additional elements/attributes to your XML schema in order to support the serialisation of enumeration state, you will want BizTalk to use the BinaryFormatter to serialise all the state for your .NET-based messages.
    b) It is easy to implement dehydration-safe enumeration.   It is easy to implement thread-safe enumeration.   It is rather harder to implement both together!   However, it can be done.   Microsoft-supplied .NET enumerators are not thread safe.   There are situations in BizTalk orchestration where thread safe enumeration can be very useful, although you can generally avoid this with care.
    c) If you find that your orchestration is doing a lot of enumeration over messages/objects with loops inside loops, and loops that span parent and child orchestrations, and especially if you are doing row-by-row validation and/or generating new message content within these loops, this may indicate that your logic would be better off implemented in a forward-chaining rules engine.   This is a big subject, and if you are not familiar with forward-chaining engines such as the Microsoft BRE, then clearly it may be difficult to make this call.    However, you should be aware of your options.

If you use XSD.exe (or some equivalent) and partial classes to create XML-serialisable .NET classes, you will find that there is fairly smooth two-way compatibility between the worlds of XSD and .NET orchestration message types.   You often may need both XSD schemas and.NET classes for the same message type, and so may need to use custom pipelines to configure the XMLDisassember to select the XSD schema class.  

If you want to pass an XML-serialisable .NET message through a Transform, you will need to assign it to an equivalent XSD-based orchestration message first.
There appears to be a 'bug'  in the current version of Visual Studio 2005 which sometimes prevents the redeployment of BizTalk projects after a recompile of non-BizTalk code contained in the same solution.    Visual Studio displays a spurious compile-time error claiming that an attempt is being made to use a non-Xml serialisable message type on an orchestration port.   If you simply close and re-start Visual Studio, you can compile and re-deploy your BizTalk application.   The problem appears to be preventable by placing all non-BizTalk code in a different solution.   It does not appear to be related to the use of partial classes, and is not due to the common mistakes made when creating Xml serialisable classes (e.g., the lack of a default constructor).    Because of this problem, it is probably better to always Receive and Send messages in orchestrations using an XSD-based message type, and then assign messages internally to a corresponding .NET message or variable for processing.   This was the only practical approach in the original release of BTS 2004.   In that case, there was a bug (fixed in SP1) which mean that subscriptions were not created correctly by orchestration Receive ports when using XML-serialisable .NET classes.

Source: BizTalk Server 2006: Using .NET Classes for Orchestration Message Types

转载于:https://www.cnblogs.com/joeyliang/archive/2007/04/07/704224.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
08-10
资源包主要包含以下内容: ASP项目源码:每个资源包中都包含完整的ASP项目源码,这些源码采用了经典的ASP技术开发,结构清晰、注释详细,帮助用户轻松理解整个项目的逻辑和实现方式。通过这些源码,用户可以学习到ASP的基本语法、服务器端脚本编写方法、数据库操作、用户权限管理等关键技术。 数据库设计文件:为了方便用户更好地理解系统的后台逻辑,每个项目中都附带了完整的数据库设计文件。这些文件通常包括数据库结构图、数据表设计文档,以及示例数据SQL脚本。用户可以通过这些文件快速搭建项目所需的数据库环境,并了解各个数据表之间的关系和作用。 详细的开发文档:每个资源包都附有详细的开发文档,文档内容包括项目背景介绍、功能模块说明、系统流程图、用户界面设计以及关键代码解析等。这些文档为用户提供了深入的学习材料,使得即便是从零开始的开发者也能逐步掌握项目开发的全过程。 项目演示与使用指南:为帮助用户更好地理解和使用这些ASP项目,每个资源包中都包含项目的演示文件和使用指南。演示文件通常以视频或图文形式展示项目的主要功能和操作流程,使用指南则详细说明了如何配置开发环境、部署项目以及常见问题的解决方法。 毕业设计参考:对于正在准备毕业设计的学生来说,这些资源包是绝佳的参考材料。每个项目不仅功能完善、结构清晰,还符合常见的毕业设计要求和标准。通过这些项目,学生可以学习到如何从零开始构建一个完整的Web系统,并积累丰富的项目经验。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值