Preparing for Exam 70-464: Developing Microsoft SQL Server 2012 Databases

This post is intended to help candidates prepare for Exam 70-464: Developing Microsoft SQL Server 2012 Databases. It features links to a number of online resources such as

  • Online References
  • Study Guides
  • Labs and Tutorials
  • Printed Material
  • Practice Tests

Exam 70-464 – Skills Measured

1. Objective: Implement Database Objects (31%)

a. Create and alter tables (complex statements).

This objective may include but is not limited to: develop an optimal strategy for using temporary objects (table variables and temporary tables); how not to rely on triggers solely as a means to manage a table; data version control and management; create tables without using the built in tools; understand the difference between @Table and #table

b. Design, implement, and troubleshoot security.

This objective may include but is not limited to: grant, deny, revoke; unable to connect; execute as; certificates; loginless user; database roles and permissions; contained users; change permission chains

c. Design the locking granularity level.

This objective may include but is not limited to: choose the right lock mechanism for a given task, handling and/or avoiding deadlocks; fix locking and blocking issues caused by previous development or third-party apps; analyse a deadlock scenario to alleviate the issue; impact of isolation level and ado defaults; impact of locks and lock escalation; reduce locking scenarios; how isolation levels affect blocking and locking; identify bottlenecks in the data design and improve

d. Maintain indexes.

This objective may include but is not limited to: inspect physical characteristics of indexes and perform index maintenance; identify fragmented indexes; identify unused indexes; implement indexes; defrag/rebuild indexes; set up a maintenance strategy for indexes and statistics; optimize indexes (full, filter index); statistics (full, filter) force or fix queue; when to rebuild versus reorg and index; create a tuning and maintenance strategy for proactive operations

e. Implement data types.

This objective may include but is not limited to: use appropriate data types; develop a CLR data type; understand the difference between @Table and #table; impact of GUID (newid, newsequentialid) on database performance, indexing and privacy; use spatial data; LOB data types; understand when and how to use column store and sparse columns; implicit and explicit conversions, integer math

f. Create and modify constraints (complex statements).

This objective may include but is not limited to: create constraints on tables; define constraints; performance implications

g. Work with XML Data.

This objective may include but is not limited to: implement XML; use XML (Query, Input, Output); transform XML data into relational data; retrieve relational data as XML; FOR XML; design a strategy to transform XML into relational data; design a strategy to query and modify XML data; understand xml data types and their schemas and interoperability, limitations, and restrictions; implement XML schemas and handling of XML data; how to handle it in SQL Server and when and when not to use it, including XML namespaces; import and export XML

2. Implement Programming Objects (21%)

a. Write automation scripts.

This objective may include but is not limited to: automate backup testing; shrink file; check index fragmentation; archive data; run an SQL Server Integration Services (SSIS) job; check disk space; automate backups

b. Design and implement stored procedures.

This objective may include but is not limited to: create stored procedures and other programmatic objects; techniques for developing stored procedures; different types of stored procedure results; create stored procedure for data access layer; analyse and rewrite procedures and processes; program stored procedures, with T-SQL and CLR#; use table valued parameters; encryption

c. Design T-SQL table-valued and scalar functions.

This objective may include but is not limited to: ensure code non regression by keeping consistent signature for procedure, views and function (interfaces); turn scripts that use cursors and loops into a SET based operation

d. Create, use, and alter user-defined functions (UDFs).

This objective may include but is not limited to: understand deterministic, non-deterministic functions; using cross apply with UDFs; Common Language Runtime (CLR)

d. Create and alter views (complex statements).

This objective may include but is not limited to: set up and configure partitioned tables and partitioned views; design a best practice for using views and stored procedures and remove the direct usage of tables

3. Design Database Objects (24%)

a. Design tables.

This objective may include but is not limited to: data design patterns; develop normalized and de-normalized SQL tables; understand the difference between physical tables, temp tables, temp table variables and common table expressions; design transactions; design views; describe advantages / disadvantages of using a GUID as a clustered index; understand performance implications of # versus @ temp tables and how to decide which to use, when and why; use of set based rather than row based logic; encryption (other than TDE); table partitioning; filestream and filetable

b. Design for concurrency.

This objective may include but is not limited to: develop a strategy to minimize concurrency; handle concurrency to minimize locking and eliminate as much blocking as possible, and to avoid deadlocks; manage the transactions to limit the time to hold lock and have fast transactions (maximize concurrency); define locking and concurrency strategy; impact of read committed snapshot / snapshot isolation; understand what it solves and what it costs

c. Create and alter indexes.

This objective may include but is not limited to: create indexes and data structures; create filtered indexes; create an indexing strategy; design and optimize indexes; design indexes and statistics; assess which indexes on a table are likely to be used given different search arguments (SARG); column store indexes; semantic indexes

d. Design data integrity.

This objective may include but is not limited to: design table data integrity policy (checks, private key/foreign key, uniqueness, XML schema); select a primary key; data usage patterns

e. Design for implicit and explicit transactions.

This objective may include but is not limited to: manage transactions; use transactions in code; ensure data integrity by using transactions; use transactions inside the database using T-SQL and from the “outside” via C#/VB; distributed transaction escalation

4. Optimize and Troubleshoot Queries (24%)

a. Optimize and tune queries.

This objective may include but is not limited to: tune a badly performing query; identify long running queries; review and optimize code;  analyse execution plans to optimize queries; tune a query that is poorly written; tune queries using execution plans and database tuning advisor (DTA); design advanced queries: pivots, utilizing common table expressions (CTE), design the database layout and optimize queries (for speed and/or data size); understand different data types; basic knowledge of query hints; tune query workloads, using realistic data sets not being production data sets ; demonstrate use of recursive CTE; full text search; control execution plans

b. Troubleshoot and resolve performance problems.

This objective may include but is not limited to: interpret performance monitor data; impact of recovery modal on database size, and recovery. How to clean up if .MDF and .LDF files get to large; identify and fix transactional replication problems; detect and resolve server hung, failure; identify and troubleshoot data access problems

c. Optimize indexing strategies.

This objective may include but is not limited to: develop optimal strategy for clustered indexes; analyse index usage; know the difference between the type of indexes and when to choose one over the other; optimize indexing for data warehousing vs. optimize Indexing for Online Transaction Processing (OLTP); generate appropriate indexes and statistics with include columns; apply effective and efficient indexes, including the use of INCLUDE lists; full-text indexing

d. Capture and analyse execution plans.

This objective may include but is not limited to: collect and read execution plan; review an execution plan to spot potential performance issues; read an execution plan; create an index based on an execution plan; row-based logic versus. Set-based logic, batching, splitting implicit transactions

e. Collect performance and system information.

This objective may include but is not limited to: use Data Management Views to determine performance issues; from system metadata; gather trace information by using the SQL Server Profiler; develop monitoring strategy for production database; run a profiler trace and analyse the results; run profiler for troubleshooting application; collect output from the Database Engine Tuning Advisor; extended events

Microsoft Online Resources

Printed Material & eBooks

Learning Plans and Classroom Training

Labs and Tutorials

Practice Tests

MeasureUp

Not Available

selftest engine

Not Available

uCertify

$119.99

Online Demo

  • 100% Exam Coverage
  • Interactive E-Book
  • Pre-Assessment Test
  • 282 Practice Questions with Full Explanations
  • 102 Interactive Quizzes
  • Chapter by Chapter Study Guide & Notes
  • Articles, How Tos, Tips, Flash Cards
  • Test History and Performance Review and Powerful Analytics
  • Study Planner

Test4actual

$89.00

Download Demo PDF

75 Q&As

Test King

$124.99

Demo Available

74 Questions and Answers

Tagged , , ,

Interface Functional Specifications Documentation Guidelines

This post is intended as generic guidelines for interface functional specifications documentation (sometimes referred to as Mapping Specs in the BizTalk developers’ community).
An interface function specifications document can be organized into sections with the following sub-sections:

  1. Introduction
    • Scope
    • Purpose
  2. Source Message
    1. Overview
      • Explains how the source message is received
      • May contain a high-level process diagram with sections relevant to receiving and further processing of the source message (up to the point where the message is transformed to the destination message) identified
    2. Receive location / method
    3. File Naming Conventions (This may not be relevant if no files are involved in the message transfer (i.e. via WCF or MQ))
    4. Message Format
      • File Type (XML or Flat File)
        • For Flat File types:
          1. Header Record (if relevant)
            • Header Record Identifier
              • Explains how a header record can be identified
            • Header Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
          2. Data / Item Record
            • Data / Item Record Identifier
              • Explains how an item record can be identified
            • Data / Item Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
          3. Trailer Record
            • Trailer Record Identifier
              • Explains how a trailer record can be identified
            • Trailer Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
        • For XML File Types:
          1. Document Schema (preferably as an imbedded schema file)
          2. Sample Files (imbedded into the document)
    5. Data Validation Requirements
    6. Error Reporting Requirements
      • Explains how errors encountered while receiving the message are handled and reported. Such errors may include
        • Communication channel errors
        • (Inbound) schema validation errors
        • Data validation errors
    7. Monitoring Requirements
      • Explains what aspects, if any, of receiving and further processing of the source message are monitored
    8. Message Archiving Requirements
      • Specifies if there is a requirement to archive the received message and details the archiving mechanism. For file archiving this would cover the following aspects
      • Archive location
      • Folder structure
      • File naming conventions
      • Housekeeping tasks, such as dealing with old archived messages
  3. Destination Message
    1. Overview
      • Explains how the destination message is sent out to the subscribers
      • May contain a high-level process diagram with the sections relevant to sending of the destination message (from the point where the message is transformed to the destination message) to the recipients identified
    2. Send location / method
    3. File Naming Conventions (This may not be relevant if no files are involved in the message transfer (i.e. via WCF or MQ))
    4. Message Format
      • File Type (XML or Flat File)
        • For Flat File types:
          1. Header Record (if relevant)
            • Header Record Identifier
              • Explains how a header record can be identified
            • Header Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
          2. Data / Item Record
            • Data / Item Record Identifier
              • Explains how an item record can be identified
            • Data / Item Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
          3. Trailer Record
            • Trailer Record Identifier
              • Explains how a trailer record can be identified
            • Trailer Record Structure
              • A table with the following columns
                • Record Number
                • Size (for positional files)
                • Position (for positional files)
                • Field Name
                • Field Specification/Data Type/Format
                • Required Indicator
                • Description
                • Example
            • Example / Sample header line
        • For XML File Types:
          1. Document Schema (preferably as an imbedded schema file)
          2. Sample Files (imbedded into the document)
    5. Data Validation Requirements
    6. Error Reporting Requirements
      • Explains how errors encountered while sending the message are handled and reported. Such errors may include
        • Communication channel errors
        • (Outbound) schema validation errors
        • Data validation errors
    7. Monitoring Requirements
      • Explains what aspects, if any, of sending of the destination message are monitored
    8. Message Archiving Requirements
      • Specifies if there is a requirement to archive the generated destination message and details the archiving mechanism. For file archiving this would cover the following aspects
      • Archive location
      • Folder structure
      • File naming conventions
      • Housekeeping tasks, such as dealing with old archived messages
  4. Destination Message Generation
    1. Overview
      • Explains how the destination message is generated
      • May contain a high-level process diagram with the sections relevant to generation of the destination message identified
    2. Mappings Specification
      • Adequately describes how to convert the Source Message(s) to the Destination Message(s) detailing all relevant business rules
      • Contains a conversion table which clearly identifies the following
        • Source Segment (i.e. XML node or a Flat File Header, Item or Trailer segment)
        • Source Field
        • Mapping / Content Transformation Rules
        • Destination Segment (i.e. XML node or a Flat File Header, Item or Trailer segment)
        • Destination Field
    3. Data Validation Requirements
    4. Error Reporting Requirements
      • Explains how errors encountered while sending the message are handled and reported. Such errors may include
        • Mapping errors
        • Data validation errors
    5. Monitoring Requirements
      • Explains what aspects, if any, of sending of the destination message are monitored
Tagged ,

Preparing for Exam 70-573 (TS: Microsoft SharePoint 2010, Application Development)

This post is intended to help candidates prepare for Exam 70-573 (TS: Microsoft SharePoint 2010, Application Development). It features links to a number of online resources such as

  • Online References
  • Installation Guides
  • Study Guides
  • Labs and Tutorials
  • Printed Material
  • Practice Tests

Exam 70-573 – Online References

1.   Objective: Working With SharePoint Data ‎(8)

a.    Content types, create and modify a custom content type

This objective may include but is not limited to: declaratively and programmatically creating and
upgrading content type using Visual Studio 2010, modifying an existing content type, site columns.

b.    Access (CRUD) data by using the Client Object Model

This objective may include but is not limited to: Javascript, .NET, Silverlight, Build Silverlight User Interface for SharePoint using Client Object Model, Query data by using CAML over the Client Object Model in Silverlight, non-data API (site, web, list, access).

c.    Access list data by using the Server object model

This objective may include but is not limited to: SPQuery, LINQ, SPList, SPSiteDataQuery, schema management, working with a query Governor, create LINQ query that includes a join statement, SPQuery Vs. SPSiteDataQuery.

d.    Access SharePoint Data by using ADO.NET Data Services

This objective may include but is not limited to: WCF ListData.svc, RESTFUL URLs conventions, create and use a client service reference.

e.    Implement and debug code that executes in an alternative security context

This objective may include but is not limited to: create code that uses the RunWithElevatedPrivileges
delegate (including debugging), create code that uses the System Account, create code that
impersonates a different user.

f.     Work with documents programmatically

This objective may include but is not limited to: SPFile, SPFolder, SPVersion, upload document and set meta data.

g.    Extending SharePoint Search

This objective may include but is not limited to: creating a custom query using full text query or
keyword query, customize the look and feel of the search result using XSLT.

h.    Work with the meta data

This objective may include but is not limited to: Access data from user profiles, taxonomy, folksonomy.

2.   Developing Web Parts and Controls ‎(4)

a.    Create Web Parts

This objective may include but is not limited to: including properties, controls using Render vs. CreateChildControl, life cycle, visual, standard Web Parts.

b.    Create connectable Web Parts

This objective may include but is not limited to: Implement consumer/provider interfaces.

c.    Debug Web Parts

This objective may include but is not limited to: ULS log, and event log, debug.log tracing, developer dashboard.

d.    Create and implement delegate controls

This objective may include but is not limited to: overriding existing controls with lower sequence, developing and using .ascx files.

3.   Objective : Working with the SharePoint User Interface ‎(5)

a.    Create a custom ribbon object

This objective may include but is not limited to: adding custom actions to the ribbon,
customizing groups, customizing tabs, customizing the existing ribbon

b.    Implement a dialog by using the Dialog Framework

This objective may include but is not limited to: Create dialogs from JavaScript or from server side, display dialogs.

c.    Customize navigation programmatically

This objective may include but is not limited to: TopNav bar, quick launch, custom actions.

d.    Create and apply branding to a SharePoint site

This objective may include but is not limited to: applying custom master pages to content pages
and application pages, placeholders, page layouts, programmatically working with
themes, deploying CSS, CSSlink, ScriptLink.

e.    Manage SPSite and SPWeb programmatically by using Visual Studio 2010

This objective may include but is not limited to: creating sub webs, referencing SPFiles, manipulating
property bag, when to call Update, referencing SPContext, SPSite, SPWeb, SPSite.OpenWeb,
SPWeb.Webs, feature activiation and deactivation.

4.   Developing Business Logic ‎(7)

a.    Manage Users, Groups, Permissions

This objective may include but is not limited to: SPGroups, SPUser, permission inheritance,
all securable objects, SPRoleDefinition, SPRole, SPRoleAssignment.

b.    Customize Enterprise Content Management (ECM)

This objective may include but is not limited to: creating a content type that inherit from
appropriate parent, creating and implementing a custom publishing field control that is page
mode aware, activating a master page programmatically including token usage.

c.    Create and implement event receivers

This objective may include but is not limited to: accessing event properties, list, item, site, email,
avoiding recursion, cancelling events, choosing synchronization state.

d.    Create, implement and debug a Timer Job

This objective may include but is not limited to: configuration, programmatic scheduling, queueing, attaching debugger to the Timer service.

e.    Create and modify BCS model in Visual Studio 2010

f.     Implement a custom workflow in Visual Studio 2010

This objective may include but is not limited to: work with initiation data or association data
to create a SharePoint task, extend a workflow imported from SharePoint Designer 2010,
use a HandleExternalEvent and CallExternalMethod to interact with a custom local service, work
with initiation data or association data in a site workflow, correlation token.

g.    Create a custom workflow action

This objective may include but is not limited to: create a custom SPD action, create and add a
custom activity to a Visual Studio workflow, define an action.xml file.

5.   Stabilizing and Deploying SharePoint Components ‎(6)

a.    Manage a feature by using Visual Studio 2010

This objective may include but is not limited to: upgrading, localizing, versioning, developing
features, feature receivers (activating and installing) that interact with their parent object,
customizing feature.xml.

b.    Manage a solution in Visual Studio 2010

This objective may include but is not limited to: modify the contained features in the solution,
add an assembly that is not included in the visual studio solution, manage mapped folders
for localization, sandbox and farm solutions, customize manifest.xml.

c.    Develop, debug, and deploy sandboxed solutions

This objective may include but is not limited to: APIs that are allowed or not allowed in sandbox, use a full trust proxy.

d.    Create a site definition by using Visual Studio 2010

This objective may include but is not limited to: feature activation, site provisioning, and localization.

(See b. Manage a solution in Visual Studio 2010)

e.    Manage SharePoint object life cycle by using the Dispose API

This objective may include but is not limited to: SPWeb, SPContext, IDisposable, Try…Catch…Finally, using blocks.

f.     Store and retrieve configuration data

This objective may include but is not limited to: App config, web config, persisted object, list, xml, file system, cookies, property bag.

Installation Guides

Building a SharePoint 2010 Virtual Machine

Critical Path Training: Building a SharePoint 2010 Virtual Machine

Building a SharePoint 2010 Virtual Machine (Using SQL Server Authentication)

MOSS How to … Sunday, November 22, 2009 by Marc Charmois: Installing SharePoint 2010 on Windows 2008 Server R2

Building a SharePoint 2010 Virtual Machine (Using DNS and Active Directories)

Lab: Building a Virtual Machine with SharePoint Server 2010

2010 Information Worker Demonstration and Evaluation Virtual Machine (RTM)

This download contains a two Windows Server 2008 R2 Hyper-V Virtual Machine set for evaluating and demonstrating Office 2010, SharePoint 2010 and Project Server 2010.

Setting Up the Development Environment for SharePoint 2010 on Windows Vista, Windows 7, and Windows Server 2008

Study Guides

Learning Plan for Developing Microsoft SharePoint Server 2010 Applications (Microsoft E-Learning)

10276AE: Microsoft SharePoint 2010, Application Development (12 Hours)

This learning plan is intended to help developers gain the knowledge and skills required to build applications by using Microsoft SharePoint Server 2010, and ultimately to prepare for

Microsoft exam 70-573.

You can save this learning plan to your profile by signing in with your Windows Live ID. To get started, first activate the plan by clicking here: Save to My Learning.

SharePoint 2010 Developer Training Course

The SharePoint 2010 Developer Training Kit provides developers with deep guidance on how to develop for SharePoint 2010. Through PowerPoint decks, Hands-On Labs, Source Code, and

Instructor-Led Videos, the developer kit walks you through an array of important developer topics–including Developer Roadmap, Visual Studio tooling, Workflow, Business Connectivity

Services, and much, much more.

Becky Bertram’s Microsoft Exam Study Guides

Exam 70-573: SharePoint 2010, Application Development

Collection 10276: Microsoft SharePoint 2010, Application Development

Cost: $191.99

Not recommended.

Labs and Tutorials

SharePoint 2010 Beta Developer Training Kit

Guidance that provides developers with advanced guidance on how to develop for SharePoint.

Overview

The SharePoint 2010 Beta Developer Training Kit provides developers with deep guidance on how to develop for SharePoint 2010. Through PowerPoint decks, Hands-On Labs, Source Code, and

Instructor-Led Videos, the developer kit walks you through an array of important developer topics–including Developer Roadmap, Visual Studio tooling, Workflow, Business Connectivity

Services, and much, much more.

System requirements

Supported Operating Systems: Windows 7, Windows Server 2008 R2

To use the guidance properly, you’ll need to have SharePoint Server 2010 Beta and Visual Studio 2010 Beta installed on a Windows operating system. Supported Operating Systems: Windows

Server 2008 R2 (64 bit) and Windows 7 (64 bit).

Instructions

After downloading the training kit, run the self-extracting executable to extract all of the training kit files to your local machine. After the content is extracted, the starting page

for the training kit will be displayed in your default browser. You can then browse through the individual hands-on labs, demos, and presentations.

SharePoint 2010: Getting Started with Development on SharePoint 2010 Hands-on Labs in C# and

Visual Basic

Overview

Use these 10 hands-on lab manuals for SharePoint 2010 to get started learning SharePoint 2010 development. Each lab is available in C# and Visual Basic.

HOL01 – Developing a Visual Web Part in Visual Studio 2010

This hands-on lab introduces the Visual Studio 2010 SharePoint development environment. It shows how to build a Visual Web Part using LINQ to SharePoint, and how to connect one Web Part

to another Web Part on the page.

HOL02 – Developing a List Definition and Event Receiver in Visual Studio 2010

This hands-on lab walks you through building a list definition for SharePoint 2010 in Visual Studio 2010. It also shows how to build an event receiver for the list in Visual Studio 2010

and deploy it to SharePoint. After the list and event receiver are deployed, you can use the developer dashboard to evaluate the performance of the event receiver.

HOL03 – Developing Advanced Web Parts for SharePoint 2010 with Visual Studio 2010

This hands-on lab shows how to build a Web Part using several SharePoint-specific controls in Visual Studio 2010. Investigate advanced built-in Web Parts, including the Data View Web

Part.

HOL04 – Developing with LINQ to SharePoint in Visual Studio 2010

This hands-on lab explores a variety of LINQ queries on SharePoint 2010, going into more depth than the introductory hands-on lab. It also walks you through an exercise of creating a

custom content type in Visual Studio 2010.

HOL05 – Developing for SharePoint 2010 with the Client OM and REST in Visual Studio 2010

This hands-on lab introduces the Client object model for use in calling SharePoint 2010 APIs from a client machine. It also shows the use of ADO.NET Data Services to call REST services in

SharePoint 2010.

HOL06 – Developing a BCS External Content Type with Visual Studio 2010

This hands-on lab walks you through building an external content type for Business Connectivity Services using Visual Studio 2010. It also builds a form for Microsoft Outlook and shows

the data being edited offline in Outlook.

HOL07 – Developing a SharePoint 2010 Workflow with Initiation Form in Visual Studio 2010

This hands-on lab walks you through building a workflow in Visual Studio 2010 for SharePoint 2010. You add an initiation form to the workflow and use an external data exchange activity in

the workflow.

HOL08 – Developing SharePoint 2010 User Interface with Silverlight in Visual Studio 2010

This hands-on lab walks you through building Microsoft Silverlight applications for use in SharePoint 2010. You will access SharePoint 2010 data in Silverlight using the Client object

model.

HOL09 – Developing SharePoint 2010 Sandboxed Solutions in Visual Studio 2010

This hands-on lab walks you through building a Sandboxed Solution Web Part for SharePoint 2010. It will also add code to the Web Part that overloads the limits placed by the sandboxed

solution, and you will review how the solution is shut down.

HOL10 – Developing SharePoint 2010 User Interface Ribbon and Dialog Customizations

This hands-on lab walks you through adding a custom action to the SharePoint 2010 ribbon, and creating a Web Part that uses the Dialog Framework.

SharePoint Server 2010 Virtual Labs

Printed Material

SharePoint 2010 Developer’s Certification: Certification Toolkit for Exams 70-573 and 70-576 [Paperback], by John Wiley & Sons, Incorpo

Practice Tests

MeasureUp

Practice Test for Microsoft 70-573 CS contains 150 Questions, Robust Explanations and performance-based simulations. Includes free SumITUp Study Guide and free Demo.

Cost: $109

selftest engine

Microsoft 70-573 Q&A – Testing Engine

 Total Questions: 49

Last Update: Sep 27, 2012

Price: $59.00

Microsoft 70-573 Questions & Answers – in .pdf

 Total PDF Q & A: 49

Last Update: Oct 13, 2012

Price: $59.00

Microsoft 70-573 Royal Pack (testing engine and .pdf version):

Price: $94.40

Actual Tests

70-573 exam and 1,800+ Other Exams

Cost: $149

exam1pass

• 50 Questions and Answers

Cost: $59

Tagged , , , , ,

Preparing for Exam 70-595 (TS: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2010)

This post is intended to help candidates prepare for Exam 70-595 (TS: Developing Business Process and Integration Solutions by Using Microsoft BizTalk Server 2010). It features links to a number of online resources such as

  • Online References
  • Installation Guides
  • Study Guides
  • Training Kits
  • Labs and Tutorials
  • Printed Material
  • Practice Tests

Exam 70-595 – Online References

Configuring a Messaging Architecture (20 percent)

Set up and manage ports

This objective may include but is not limited to: add a map, add role links, ordered delivery, send ports, send port groups, starting vs. enlisting, receive ports, receive locations, subscriptions, subscription states, advanced messaging concepts (backup transport, priorities, routing failures)

  • Training Kits\Developer TK\Modules\BT10D_05 – Routing BizTalk Messages.docx
  • Training Kits\Developer TK\Modules\BT10D_15 – Implementing Messaging Patterns.docx  – Lesson 1: Creating Adaptable Orchestration Ports
  • Training Kits\Developer TK\Modules\BT10D_08 – Creating a BizTalk Orchestration.docx -

Lesson 2: Building an Orchestration

Plan for and implement secure messaging

This objective may include but is not limited to: certificates, signing, encryption, port authentication, encoding

Configure core adapters

This objective may include but is not limited to: HTTP, POP3, SMTP, FTP, File

  • Training Kits\Developer TK\Modules\BT10D_07 – Integrating with Adapters.docx
  • Training Kits\What’s New TK\Manuals\BT10D_16 – Integrating with the WCF LOB (Optional).docx
  • Training Kits\What’s New TK\Manuals\Dev- Lab 2D Integrating using the FTP Adapter.doc

Configure content-based routing

This objective may include but is not limited to: set a filter that uses a promoted property

  • Training Kits\Developer TK\Modules\BT10D_05 – Routing BizTalk Messages.docx

Implement messaging patterns

This objective may include but is not limited to: normalizing/canonical messages, splitter, large messages

  • Training Kits\Developer TK\Modules\BT10D_15 – Implementing Messaging Patterns.docx – Lesson 2: Receiving Multiple Related Messages

Developing BizTalk Artifacts (20 percent)

Create schemas

This objective may include but is not limited to: create a flat-file schema, create a property schema, enveloping, promoted/distinguished properties, Message Type, schema re-use (import/include)

  • Training Kits\Developer TK\Modules\BT10D_02 – Creating Schemas.docx

Create maps

This objective may include but is not limited to: functionid scripting, XSLT, pass a parameter to a map, multiple schemas, looping

  • Training Kits\Developer TK\Modules\ BT10D_03 – Creating Maps.docx

Create pipelines

This objective may include but is not limited to: disassembling, create a custom pipeline, create a pipeline component, XML validation

  • Training Kits\Developer TK\Modules\ BT10D_06 – Creating Pipelines.docx

Develop orchestrations

This objective may include but is not limited to: work with transactions and persistence, integrate with Microsoft .NET assemblies, parameters, and shapes

  • Training Kits\Developer TK\Modules\ BT10D_08 – Creating a BizTalk Orchestration.docx
  • Training Kits\Developer TK\Modules\ BT10D_10 – Creating Transactional Business.docx

Configure orchestration bindings

This objective may include but is not limited to: direct, dynamic, self-correlating

  • Training Kits\Developer TK\Modules\ BT10D_08 – Creating a BizTalk Orchestration.docx

Configure correlation

This objective may include but is not limited to: listener shape, parallel shape, correlation sets

  • Training Kits\Developer TK\Modules\ BT10D_08 – Creating a BizTalk Orchestration.docx
  • Training Kits\Developer TK\Modules\ BT10D_09 – Automating Business Processes.docx

Construct messages

This objective may include but is not limited to: multi-part, untyped, construct messages in .NET, construct messages in orchestrations, context properties

  • Training Kits\Developer TK\Modules\ BT10D_08 – Creating a BizTalk Orchestration.docx

Debugging and Exception Handling (17 percent)

Handle exceptions in orchestrations

This objective may include but is not limited to: compensation, scope shapes, throw exceptions, long-running transactions

  • Training Kits\Developer TK\Modules\ BT10D_09 – Automating Business Processes.docx

Route errors

This objective may include but is not limited to: port configuration, recoverable interchange

Debug orchestrations

Validate and test artifacts

This objective may include but is not limited to: schemas, maps, pipelines

Integrating Web Services and Windows Communication Foundation (WCF) Services (14 percent)

Configure a WCF adapter

This objective may include but is not limited to: WS*, custom bindings

  • Training Kits\Developer TK\Modules\BT10D_07 – Integrating with Adapters.docx
  • Training Kits\Developer TK\Modules\BT10D_13 – Using WCF Receive Adapters
  • Training Kits\What’s New TK\Manuals\Dev- Lab 2A Consume a WCF Service.doc
  • Training Kits\What’s New TK\Manuals\Dev- Lab 2B Publishing Schemas and Orchestrations as WCF Services.doc
  • Training Kits\What’s New TK\Manuals\Dev- Lab 2B Publishing Schemas and Orchestrations as WCF Services.doc

Expose orchestrations by using publishing wizards

Consume services

This objective may include but is not limited to: web port type, add a Web services reference, consuming from orchestrations or pure messaging

  • Training Kits\What’s New TK\Manuals\ Dev- Lab 2A Consume a WCF Service.doc

Handle web exceptions

This objective may include but is not limited to: delivery notifications, catching SOAP exceptions

Implementing Extended Capabilities (13 percent)

Create and deploy Business Rules Engine (BRE) components

This objective may include but is not limited to: work with the Business Rules Composer, deploy Business Rules policies, call from an orchestration, and develop vocabularies

  • Training Kits\Developer TK\Modules\BT10D_11 – Integrating Business Rules.docx

Develop Electronic Data Interchange (EDI) solutions

This objective may include but is not limited to: trading partner setup, batching, acknowledgments, importing schemas, configuring AS2, party configurations, pipelines, ports, certificates

  • Training Kits\Developer TK\Modules\ BT10D_18 – Receiving EDI Messages (Optional).docx
  • Training Kits\Developer TK\Modules\ BT10D_19 – Sending EDI Messages (Optional).docx
  • Training Kits\What’s New TK\Manuals\Dev- Lab 3 Create a Role and Party Based Integration Solution.docx

Implement Radio Frequency Identification (RFID) solutions

This objective may include but is not limited to: handle events, configure RFID devices, manage and configure event sink endpoints

Plan and implement Business Activity Monitoring (BAM)

This objective may include but is not limited to: BAM alerts, tracking profile editor, BAM workbook, activities, views, deployment

  • Training Kits\Developer TK\Modules\BT10D_05 – Routing BizTalk Messages.docx – Lesson 3: Monitoring Orchestrations and Messages
  • Training Kits\Developer TK\Modules\BT10D_11 – Integrating Business Rules.docx
  • Training Kits\Developer TK\Modules\BT10D_12 – Enabling Business Activity Monitoring.docx
  • Training Kits\Developer TK\Modules\ BT10D_17 – WF and WCF Interceptors for BAM (Optional).docx

Deploying, Tracking, and Supporting a BizTalk Solution (16 percent)

Install and configure a multi-server BizTalk environment

This objective may include but is not limited to: trusted vs. untrusted environments, Active Directory groups

  • Training Kits\Administrator TK\Modules\BT10A_02 – Installing a BizTalk Server Hosting Environment.docx – Planning a Multiple-Server Environment
  • Training Kits\Administrator TK\Modules\BT10A_05 – Administering a BizTalk Server Environment.docx

Deploy BizTalk applications

This objective may include but is not limited to: Microsoft Installer Package (MSI) deployment, versioning, resources, multiple staging environments such as development, test, and production

  • Training Kits\Administrator TK\Modules\ BT10A_03 – Deploying BizTalk Applications.docx

Export and import binding files

  • Training Kits\Administrator TK\Modules\BT10A_03 – Deploying BizTalk Applications.docx

Configure tracking

This objective may include but is not limited to: orchestrations, schemas, ports, pipelines, policies

  • Training Kits\Administrator TK\Modules\BT10A_04 – Managing BizTalk Applications.docx

Manage BizTalk solutions by using the Administration Console

This objective may include but is not limited to: query for instances, terminate, resume

  • Training Kits\Developer TK\Modules\ BT10D_04 – Deploying and Managing BizTalk Applications
  • Training Kits\Administrator TK\Modules\ BT10A_04 – Managing BizTalk Applications.docx

Installation Guides

Installing BizTalk Server 2010 on Windows 7 and Windows Vista

Document: Installing BizTalk Server 2010 on Windows 7 and Windows Vista.docx

Installing BizTalk Server 2010 on Windows Server 2008 R2 and 2008

Document: Installing BizTalk Server 2010 on Windows Server 2008 R2 and 2008.docx

Installing BizTalk Server 2010 and BAM in a Multi-Computer Environment

Document: Installing BizTalk Server 2010 and BAM in a Multi-Computer Environment.docx

KWUserGuide.exe

Setup Troubleshooting Guide

Document: Troubleshooting BizTalk Server 2010 Setup.docx

BizTalk Server 2010 Developer Virtual Machine

Supported Operating Systems: Windows Server 2008 R2

Windows Server 2008 R2 Hyper-V is required to use the virtual machine included with this training kit.

In addition to the system requirements for Windows Server 2008 R2 as described in the release notes, a 64-bit system with hardware-assisted virtualization enabled and data execution prevention (DEP) is required.

It is also recommended to ensure that you have a clean install of x64 edition of Windows Server 2008 R2 to be able to use the Hyper-V technology.

Prerequisites, installation steps, OS recommendations, and known issues of Hyper-V can be found here.

An import utility is included with the training kit. To use the import utility, the .NET Framework 4 must be installed on the host OS.

Study Guides

Ramp-up: Developer Introduction to BizTalk Server 2010

This training kit is available as a full download, and includes a complete recorded delivery of the class. You can also review and download the resources for each module, and even complete the lessons online using the Virtual Lab environment.

Introduction to BizTalk Server 2010

BizTalk Server 2010 helps customers efficiently and effectively integrates systems, employees, and trading partners faster than ever before. BizTalk Server 2010 introduces a host of new performance features and an improved toolset that enables developers, IT professionals, and business analysts to build, deploy, and analyze complex application integration and business process automation scenarios.

Creating Schemas

BizTalk Server 2010 can receive messages formatted as XML, flat files, or as Electronic Document Interchange (EDI). Regardless of the format of the incoming message, the BizTalk orchestration and messaging engine always processes messages in XML format. This requires that a schema be defined to convert the message to XML format that BizTalk can process. In the case of flat file or EDI messages, XSD (XML Schema Definition) annotations are used within the schemas to provide the additional information that the relevant parsers require. This module provides the knowledge and skills necessary for developers to create XML and flat file schemas.

Creating Maps

Using the Microsoft BizTalk Mapper, you define the relationship between an input and an output schema using links and functoids. A link defines a direct data copy of a record or field. Links can directly connect to items in the other schema, or they can form connections to functoids. Functoids perform more complex data manipulations. This module discusses the role that Microsoft BizTalk maps play in BizTalk Server architecture, and how to work with maps and functoids.

 

Deploying and Managing BizTalk Applications

BizTalk Server 2010 includes features that simplify the management and deployment of BizTalk applications. BizTalk provides an application container for the items in a business solution. The items that can be grouped as an application include orchestrations, schemas, maps, pipelines, and Microsoft .NET assemblies. You can manage, modify, deploy, and install all of the items in an application as a single entity.

Routing BizTalk Messages

BizTalk Server provides a mechanism for routing, processing, and sending messages between business processes. Content-based routing (CBR) is a method of routing messages based on the context and/or content of an incoming message. BizTalk provides two methods of monitoring and tracking message activity, which enables developers, administrators, and business users to diagnose messaging problems. This module shows you how to enable message routing, and use BizTalk tools to monitor live and archived message activity.

Creating Pipelines

Pipelines enable the pre-processing of messages as they enter or leave the MessageBox database. Pipelines can also be called from within an orchestration. Pipelines are used to provide additional processing to messages, such as encoding and decoding, encrypting and decrypting, and other processing that might be required to work with messages in BizTalk Server.

BizTalk Server supports the ability to modify pipeline properties on a per-use basis, which reduces the need to modify pipelines frequently, and the ability to call pipeline components from within an orchestration.

Integrating with Adapters

Because BizTalk Server 2010 must be able to exchange messages with a variety of other systems and applications, specialized adapters are required. An adapter is a COM or Microsoft .NET–based software component that provides the functionality required to interface with different types of applications and sometimes proprietary communications mechanisms. This module explains how adapters work, and shows you how to configure specific types of adapters that are included with BizTalk Server 2010.

Creating a BizTalk Orchestration

By using BizTalk Server, you can orchestrate dynamic business processes both within and between organizations. By using BizTalk Server, developers, information workers, and IT professionals can work together to rapidly design, create, and deploy integration solutions that work across applications, platforms, and organizations.

Automating Business Processes

Orchestration is a flexible, powerful tool for representing your executable business processes. You can design the message flow, interpret and generate data, call custom code, and organize it all in an intuitive visual drawing. It is important for you to become familiar with the various shapes that BizTalk Orchestration Designer provides to represent the logical flow of your orchestration. You should also know how to manipulate data and manage exceptions within an orchestration.

Creating Transactional Business Processes

A BizTalk Server orchestration provides a transactional programming model that includes support for both atomic and long-running transactions, in addition to support for nested orchestrations, exception handling, and methods for recovering from failed transactions.

Integrating Business Rules

By using the BizTalk Server Business Rule Engine (BRE), business users can work with developers to create and maintain policies that contain business rule sets. These policies can be quickly updated and immediately applied without the need to recompile and redeploy a BizTalk assembly. Policies can be called from within a BizTalk orchestration and from other Microsoft .NET applications. This module provides an overview of BRE, and describes the use of policies, rules, and vocabularies. This module also covers execution of business policies from BizTalk Server 2010.

Enabling Business Activity Monitoring

Getting the correct information at the correct time is of critical importance to any business. Business deals and partnerships are often made or broken solely over questions of information access. The decisive advantage frequently goes to the business that is armed with the best information.

The Business Activity Monitoring (BAM) Framework in BizTalk Server gives you just such an indispensable advantage. By opening a real-time window into running business processes, BAM provides business analysts with a direct view of transactions as those transactions occur—a view that has traditionally been unavailable.

Using WCF Receive Adapters

Web services provide industry-standard mechanisms for conducting e-business by communicating across disparate systems. BizTalk Server 2010 includes a number of receive adapters that support integration with web services by making use of Windows Communication Foundation (WCF).

WCF provides support for a wide array of the current web service standards. This support enables developers to both consume a web service as part of a business process and to publish a business process as a web service that can be consumed by external applications.

In this module, you will learn how to configure BizTalk receive locations that accept messages via the BizTalk WCF receive adapters, and to publish BizTalk orchestrations and schemas as WCF web services.

Using WCF Send Adapters

The purpose of this lab is to introduce you to the integration between the BizTalk Server messaging components and web services. You’ll use a built-in WCF adapter, which provides integration with web services using Windows Communication Foundation.

First, you will add a service reference to generate the necessary artifacts for consuming a web service using the WCF adapters. Next, you’ll walk through the process of consuming a web service from within an orchestration.

Implementing Messaging Patterns

In this lab you will update the Northwind ordering process to make the orchestration messaging more dynamic, and add support for correlation. You will use role links to provide partner-specific sending and receiving, and add dynamic links to support a publish and subscribe messaging model for your orchestrations. In addition, you will use correlation to route related messages to an orchestration instance.

Training Kits

What’s New in BizTalk Server 2010 Training Kit

The What’s New in BizTalk Server 2010 training kit includes labs and training videos to help you learn about the new features of BizTalk Server 2010.

This training kit contains the following content:

  • Hands On Labs
  • Creating BizTalk Maps with the new Mapper
  • Consuming a WCF Service
  • Publishing Schemas and Orchestrations as WCF Services
  • Integrating with Microsoft SQL Server
  • Integrating using the FTP Adapter
  • Developers – Create a Role and Party-based Integration Solution
  • Exploring the New Settings Dashboard
  • Monitoring BizTalk Operations using System Center Operations Manager 2007 R2
  • Administrators – Create a Role and Party-based Integration Solution

BizTalk Server 2010 Developer Training Kit

This training kit contains a complete set of materials that will enable you to learn the core developer capabilities in BizTalk Server 2010. This kit includes lab manuals, PowerPoint presentations and videos, all designed to help you learn about BizTalk Server 2010. There is also an option below to download a Virtual Machine that is ready for you to use with the training kit.

About This Hands-On Lab

This five-day instructor-led course consists of a series of hands-on labs that provides students with the knowledge and skills to develop applications using Microsoft BizTalk Server. The labs focus on how to work with schemas, maps, and pipelines; process flat files; implement transactions; integrate business rules; and more.

Audience Profile

This course is intended for Developers who want to learn how to develop applications with BizTalk Server.

At Hands-On Lab Completion

After completing this course, students will be able to:

  • Work with schemas, maps, and pipelines, and create flat file schemas.
  • Configure a new FTP, HTTP and Windows SharePoint Services (WSS) adapter for BizTalk Server
  • Use BizTalk Orchestration Designer to create and test a simple orchestration.
  • Configure orchestration properties and variables, deploy an orchestration, and create and deploy a rule set and execute those rules from within an orchestration.
  • Define, deploy, and map a BAM observation model.
  • Use the deployment and management features in BizTalk Server
  • Build a simple Windows Communication Foundation (WCF) service and client and configure BizTalk Server to use a WCF Adapter.
  • Create a Microsoft .NET class library project that will contain a WCF Adapter.
  • Deploy artifacts needed for processing certain EDI documents and for turning XML messages into EDI.

BizTalk Server 2010 Administrator Training Kit

This training kit contains a complete set of materials that will enable you to learn the core administrator capabilities in BizTalk Server 2010. This kit includes lab manuals, PowerPoint presentations and videos, all designed to help you learn about BizTalk Server 2010. There is also an option below to download a Virtual Machine that is ready for you to use with the training kit.

About This Hands-On Lab

This three-day instructor-led course provides students with the knowledge and skills required to install and configure a computer running Microsoft BizTalk Server 2010. The course also shows you how to deploy and manage BizTalk applications in a production environment.

Audience Profile

This course is intended for systems engineers and network administrators with two to three years of experience managing an enterprise-level Microsoft Windows Server environment.

At Course Completion

After completing this course, students will be able to:

  • Describe the services and tools provided in BizTalk Server 2010.
  • Install BizTalk Server 2010 on a computer.
  • Deploy BizTalk applications to a BizTalk server 2010 computer.
  • Manage and monitor BizTalk applications on a BizTalk Server 2010 computer.
  • Manage BizTalk Server groups and backup a BizTalk Server 2010 computer.
  • Monitor a BizTalk Server environment with System Center Operations Manager.

Labs & Tutorials

BizTalk Server Tutorials

“How Do I?” Videos for BizTalk Server

Microsoft BizTalk Adapter Pack 2010

Microsoft BizTalk Adapter Pack 2010 Samples

BizTalk Adapter Pack 2010 is a set of adapters built on top of the Microsoft Windows Communication Foundation (WCF) Line of Business (LOB) Adapter SDK. These adapters enable service-oriented programmatic access in order to interact with an external system. The samples on this page demonstrate some of the features of these adapters.

Download entire collections of samples, or browse and download individual samples:

BizTalk Server RFID 2010 Tutorials

The BizTalk RFID tutorials contain detailed steps for implementing simple scenarios to give new users an experience of using a variety of BizTalk RFID tools and APIs while creating compiled, testable solutions.

BizTalk Server Tutorial

BizTalk Server Tutorial – BizTalk Server Concepts and Common Errors

Bill Osuch – Random geek notes – BizTalk

 

Printed Material

Microsoft BizTalk Server 2010 Unleashed

Authors: Brian Loesgen, Charles Young, Jan Eliasen, Scott Colestock, Anush Kumar, Jon Flanders

Paperback, 864 pages

Amazon

Price: $37.79

Product Description

The authors begin by introducing BizTalk Server’s architecture and key integration concepts. Next, they offer in-depth coverage of BizTalk’s foundational features, including schemas, maps, orchestrations, and pipelines. You’ll learn how to effectively utilize both standard and custom adapters; monitor integration services; leverage cloud computing via Windows Azure; implement operational BI solutions; and make the most of business rules and BizTalk’s Business Rules Engine (BRE).

The authors offer best practices and “in the trenches” tips for everything from managing deployments through implementing state-of-the-art mobile RFID solutions. No other book offers this much useful, pragmatic, and tested knowledge for successful BizTalk development.

  • Apply BizTalk Server’s sophisticated, scalable message exchange model to support virtually any business requirement
  • Get your schemas right the first time, so you can avoid major problems downstream
  • Use BizTalk Mapper to create maps for transforming inbound and outbound XML messages and supporting business processes
  • Use orchestration to automate even highly-complex processes
  • Utilize adapters and WCF to integrate any application, service, or system
  • Extend your application’s reach with Windows Azure AppFabric
  • Capture key BizTalk infrastructure, services, and business metrics
  • Build powerful rules-based solutions with Microsoft’s Business Rules Framework
  • Establish an Enterprise Service Bus (ESB) that uses BizTalk Server as core messaging infrastructure
  • Efficiently manage, configure, and troubleshoot BizTalk through the Administration Console
  • Create RFID applications ranging from simple label printing to end-to-end business processes

Customer Reviews

Microsoft BizTalk Server 2010 Unleashed provides a solid overview of BizTalk 2010. The book goes beyond listing the features of the product and goes into how to use it in practical ways. It provides ‘developer centric’ information on how to plan, build and test real-world solutions. There is a very large discussion on business rules and rules based programming. I did find one area where the book lacked coverage and that was in the area of Trading Partner Management (TPM). TPM was completely rewritten for BizTalk 2010 with new concepts. It would have been nice to provide some explanation of this. Overall the book does a nice job of explaining BizTalk 2010. I would recommend this book to any BizTalk developer.

BizTalk 2010 Recipes: A Problem-Solution Approach (Expert’s Voice in BizTalk)

Authors: Mark Beckner

Paperback, 608 pages

Amazon

Price: $41.99

 

Safari Preview

Product Description

BizTalk 2010 Recipes provides ready-made solutions to BizTalk Server 2010 developers. The recipes in the book save you the effort of developing your own solutions to common problems that have been solved many times over. The solutions demonstrate sound practice, the result of hard-earned wisdom by those who have gone before.

Presented in a step-by-step format with clear code examples and explanations, the solutions in BizTalk 2010 Recipes help you take advantage of new features and deeper capabilities in BizTalk Server 2010. You’ll learn to provide rich mapping support, extended electronic data interchange (EDI) and trading partner management capabilities, and to deploy the growing range of adapters for integrating with the different systems and technologies that you will encounter.

Author Mark Beckner doesn’t overlook core functionality, either. You’ll find recipes covering all the core areas: schemas, maps, orchestrations, messaging and more. BizTalk Server 2010 is Microsoft’s market-leading platform for orchestrating process flow across disparate applications. BizTalk 2010 Recipes is your key to unlocking the full power of that platform.

What you’ll learn
  • · Automate business processes across different systems in your enterprise.
  • · Build, test, and deploy complex maps and schemas.
  • · Implement the business rules engine (BRE).
  • · Develop business activity monitoring (BAM) solutions.
  • · Manage electronic data interchange (EDI) with trading partners.
  • · Monitor and troubleshoot automated processes.
Who this book is for

BizTalk 2010 Recipes is aimed at developers new to Microsoft BizTalk Server 2010. Experienced BizTalk developers will also find great value in the information around new functionality in the 2010 release such as that for mapping and for EDI trading partner management. Those brand new to BizTalk will appreciate the clear examples of core functionality that help them understand how best to design and deploy BizTalk Server solutions.

Table of Contents
  1. What’s New in BizTalk Server 2010
  2. Document Schemas
  3. Document Mapping
  4. Messaging and Pipelines
  5. Orchestrations
  6. Adapters
  7. Business Rules Framework
  8. EDI Solutions
  9. Deployment
  10. Administration and Operations
  11. Business Activity Monitoring

Customer Reviews

No book does a better job of showing you how to use the many powerful features of BizTalk. Each chapter contains a short, clear, yet realistic example of how to perform a specific BizTalk task. There’s never any complex setup required, so you can work through most chapters in half an hour or less. Via these small steps the book covers nearly all the essential parts of BizTalk, including the rules engine, EDI and BAM.

The biggest disappointment with this new edition is the inadequate coverage of BizTalk’s support for WCF. The examples of how orchestrations can expose and consume web services use WCF, but the section on Adapters discusses the old HTTP and SOAP adapters without mentioning the WCF adapters. This could lead you to think that WCF is only used with orchestrations, which is not the case. Worse, the chapter on connecting to SQL Server uses the old (and now deprecated) SQL adapter instead of the new WCF-based SQL adapter. To get a firm grasp of WCF in BizTalk you should consult Richard Seroter’s SOA Patterns with BizTalk Server 2009.

To design successful BizTalk solutions you need a bit more architectural orientation than this book provides, and for that I recommend Dunphy’s Pro BizTalk 2009 and the Seroter book. But to acquire hands-on mastery, BizTalk Recipes is indispensable, both as a tutorial and a reference.

 

Practice Tests

selftest engine

Evaluation software is available.

  • 50 Questions & Answers
  • Practice Test (50 Questions)

Price: $95

Actual Test

  • 50 Questions & Answers
  • 1,800+ Other Exams
  • 1-YearExam Engine Access

Price:

Unlimited Lifetime Access $149 Package: $149.00

ActualTests Exam Engine: 1-year subscription: $189.00

exam1pass

  • 50 Questions and Answers

Price: $59

techeXams

  • 50 Questions and Answers

Price: $34.95

Tagged , , , , , ,

Implementing Icon Overlay Handlers in C#

A seemingly easy task of implementing Windows Explorer Icon Overlay Handlers may in fact prove challenging due to the lack of concise online references which would address all implementation aspects and mention the limitations you may have to deal with… The aim of this blog is to provide such reference, along with a sample Windows Explorer Icon Overlay Handler implementation. The following will be addressed:

  • Online References – You may need to cover the theory prior to designing and coding your custom handlers
  • Limitations – Be aware of limitation and peculiarities of Windows Explorer (i.e. it may not be possible to position the overlay anywhere other than the bottom left corner)
  • Implementation – Consider using inheritance and move most of your code into a base class
  • Registration – Use RegAsm.exe utility to register and unregister your assemblies
  • Debugging – How to debug your code and which sections of your code may not be debugged at all

1. Cover the Theory by Reading the Following Articles and References:

Online Reference

IShellIconOverlayIdentifier interface

Defines
methods that handle all communication between icon overlay handlers and the
Shell.

An
overlay handler must implement this interface.

The interface has three methods: GetOverlayInfo, GetPriority, and IsMemberOf.

How to Implement Icon Overlay Handlers

Step by step instructions of how to implement IShellIconOverlayIdentifier
interface
, code invariant.

Creating Icon Overlay Handlers

Describes IShellIconOverlayIdentifier interface
methods functionality and other aspects such as

Discusses certain limitations of icon overlay handlers.

Shell Reference

Use this MSDN reference for details on IShellIconOverlayIdentifier
interface methods signatures and parameters.

Icon overlay in c#

A sample C# implementation of an icon overlay
handler, with implementation and registration details explained in the
question-answer fashion. 

TortoiseOverlays
– an overlay handler for Tortoise clients

A C++ implementation of the icon overlay handler.

Most complexity in this code is around overcoming
one of the limitations: only 15 Icon Overlay Handlers are supported by the
operating system. The code inside the GetOverlayInfo method examines contents
of the registry to determine how many icon overlay handlers are already
registered and, based on the number of available spots, selectively registers
Tortoise Overlay Handlers.

Tortoise Overlays – Icons

Multi-resolution icons used by Tortoise. Download and open these icons in an icon editing tool such as IconFX and examine the contents.

Icons used for an overlay should ideally be a multi-image icon, with 256×256, 64×64, 48×48, 32×32, 24×24 and 16×16 images
imbedded. The operating system will select the image of the most suitable
resolution (i.e. 16×16 may be used in tree and the list views, whereas 64×64
imbedded icon will be used when the Extra Large Icons viewing option is
selected).

2. Understand Limitations

It is important to have a clear idea about the limitations and peculiarities of the Icon Overlay Handlers prior to plunging head on into design and implementation stages as there are many:

a.Only One Overlay Icon per Overlay Icon Handler is allowed.

It is only possible to load one string, a path to the icon file to be used as an overlay, in the GetOverlayInfo method, which is invoked once in the instantiation stage (when Windows Explorer starts up and load all the associated resources). Therefore, only one overlay icon is supported per IconOverlayHandler. In order to facilitate multiple overlay icons, a number of IconOverlayHandlers have to be implemented and the corresponding assemblies registered with RegAsm.exe. For instance, Dropbox registers DropboxExt1, DropboxExt2, DropboxExt3, and DropboxExt4 icon overlay handlers, as can be seen in the registry in the ShellIconOverlayIdentifiers subfolders.

b. Only a Limited Number of Icon Overlay Handlers (15) is supported by the System.

The number of different icon overlay handlers that the system can support is limited by the amount of space available for icon overlays in the system image list. There are currently fifteen slots allotted for icon overlays, some of which are reserved by the system. For this reason, icon overlay handlers should be implemented only if there are no satisfactory alternatives.

c. Only One Overlay Icon per File or Directory is supported.

Whenever you navigate to a directory in your file system or a location in your network, IsMemberOf method of all registered overlay handlers gets invoked for each item in that directory (such as files and subdirectories, the path to which are passed in LPCWSTR pwszPath parameter) in the order of priority assigned by the system, until one of those methods returns S_OK, telling to the operating system to use the associated overlay icon. No calls to IsMemberOf method implemented by icon overlay handlers with lower priority are made for that particular item.

d. Only Bottom Left Corner of an Item Icon is reserved for the Overlay.

If you attempt to position the overlays anywhere but in the bottom left corner by designing overlays to be the size of the actual item icon used by the operating system, you will find that that approach works for 16×16 icons, but not for higher resolution icons: only a progressively smaller portion of the overall icon area is reserved for the overlay and that dedicated area is invariably in the bottom left corner (this behaviour may be specific to the version of Windows operating system, in my case Windows Server 2008 R2 Enterprise, Service Pack 1)

e. You have only Limited Control over Priority assigned by the Operating System to a Registered Overlay Icon Handler.

You may get a false sense of security from assuming that you may have control over the order in which the system invokes GetPriority method of the registered icon overlay handlers: the online MSDN reference states that:

  • The function of GetPriority method is to specify the priority of an icon overlay.
  • pPriority [out] parameter contains the address of a value that indicates the priority of the overlay identifier.
  • Possible values range from zero to 100, with zero the highest priority.

Even though this approach may work on an application level, this will definitely not work across all registered handlers, as you have no control over the priority values of icon overlay handlers registered by other applications. (And let me assure you, most of developers will do their best to insure that their icon overlay shows up by giving setting the priority to 0, the highest).

From my experience, setting pPriority to values other than 0 had no effect whatsoever, unless the pPriority is set to 100 (the lowest), in which case the handler does not get invoked at all unless there are no other registered handlers. (Please note, this behaviour may be specific to the version of Windows operating system, Windows Server 2008 R2 Enterprise, Service Pack 1, in my case).

In fact, the single most important factor determining the order in which Image Overlay Handlers are invoked is, surprisingly, the order in which the registration keys appear in the registry subfolder, which is alphabetical:

As you can see, I’ve given the assemblies (AMyIconOverlayHandlersAdded, AMyIconOverlayHandlersConflict and AMyIconOverlayHandlersDeleted) a name prefixed with an A to ensure the precedence.

You must be extremely careful when implementing overlay icons handlers as registration and invocation of those may result in the default system overlay icon handlers or the handlers registered by other applications no longer functioning.

Also, be prepared for the icon overlay handlers registered by other applications getting prioritised by the operating system and effectively overriding the icon overlay handlers registered by your application.

3. Implement Icon Overlay Handlers.

Suppose we need to implement icon overlay handlers to

  • Display an Added icon overlay for all files which names starting with ‘Added’ and which are located in {Environment.SpecialFolder.UserProfile}/IconOverlayTest folder
  • Display a Conflict icon overlay for all files which names start with ‘Conflict’ and which are located in {Environment.SpecialFolder.UserProfile}/IconOverlayTest folder
  • Display a Deleted icon overlay for all files which names start with ‘Deleted’ and which are located in {Environment.SpecialFolder.UserProfile}/IconOverlayTest folder
  • Do not overlay default icons otherwise

Implementation steps would be as follows:

a. Provide overlay icons

Download AddedIcon.ico, ConflictIcon.ico and DeletedIcon.ico and save the files to {
Environment.SystemDirectory}/ProgramData/IconOverlayTest.

You may choose to design your own icons using a specialised icon editing
tool such as IconFX. Icons used for an overlay should ideally be a multi-image icon, with 256×256, 64×64, 48×48, 32×32, 24×24 and 16×16 images imbedded. The operating system will select the image of the most suitable resolution (i.e. 16×16 may be used in tree and the list views, whereas 64×64 imbedded icon will be used when the Extra Large Icons viewing option is selected):

b. Create a Visual Studio Solution

In Visual Studio (I am using VS 2010 Professional), select File – New – Project – Class Library as the template, select a location for your project and name project MyIconOverlayHandlersBase and adjust the solution name to MyIconOverlayHandlers.

c. Set up a Project for a Base Class

Change the Default namespace from MyIconOverlayHandlersBase to MyIconOverlayHandlers and Assembly name from MyIconOverlayHandlersBase to AMyIconOverlayHandlersBase:

Rename Class1.cs to MyIconOverlayHandler.cs.

You will you use RegAsm.exe utility to register the assemblies, which means you are required to
sign the assemblies with a strong name:

d. Set up Projects for Child Classes

As discussed in section 2 Understand Limitations, we need to implement and register a separate icon overlay handler for each desired icon overlay, i.e. four handlers in total.

The functionality of each handler will be similar, which means most of the code and implementation details can be move to a base class, MyIconOverlayHandlersBase. This class will implement IShellIconOverlayIdentifier interface as required, and the three other classes MyIconOverlayHandlersAdded, MyIconOverlayHandlersConflict and MyIconOverlayHandlersDeleted extending the base class MyIconOverlayHandlersBase and handling implementation differences:

Each of the base and child classes will be contained in a separate assembly so we need to create projects for all child classes as well, renaming Class1.cs to MyIconOverlayHandler.cs and signing the assembly in each case:

Add a reference to the MyIconOverlayHandlersBase project to each of the other three projects:

e. Implement the Base Class

Include the following statements:


using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;

First of all, you will find it useful to define the constants in MyIconOverlayHandlers namespace:


    [Flags]
    public enum HFLAGS : uint
    {
        ISIOI_ICONFILE = 0x00000001,
        ISIOI_ICONINDEX = 0x00000002
    }

    [Flags]
    public enum HRESULT : uint
    {
        S_OK = 0x00000000,
        S_FALSE = 0x00000001,
        E_ABORT = 0x80004004,
        E_ACCESSDENIED = 0x80070005,
        E_FAIL = 0x80004005,
        E_HANDLE = 0x80070006,
        E_INVALIDARG = 0x80070057,
        E_NOINTERFACE = 0x80004002,
        E_OUTOFMEMORY = 0x8007000E,
        E_POINTER = 0x80004003,
        E_UNEXPECTED = 0x8000FFFF
    }

    public enum PFSTATUS
    {
        SYNCING,
        OK,
        LOCKED,
        UNLOCKED,
        CLOUD,
        SHORTCUT,
        NULL
    }

Use this MSDN reference for details on IShellIconOverlayIdentifier interface methods signatures and parameters to provide the definition for IShellIconOverlayIdentifier interface:


    [ComVisible(false)]
    [ComImport]
    [Guid("0C6C4200-C589-11D0-999A-00C04FD655E1")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    public interface IShellIconOverlayIdentifier
    {
        [PreserveSig]
        int IsMemberOf([MarshalAs(UnmanagedType.LPWStr)]string path, uint attributes);

        [PreserveSig]
        int GetOverlayInfo(IntPtr iconFileBuffer, int iconFileBufferSize, out int iconIndex, out uint flags);

        [PreserveSig]
        int GetPriority(out int priority);
    }

Add MyIconOverlayHandlerBase class to MyIconOverlayHandlers namespace to implement the IShellIconOverlayIdentifier interface:


    public class MyIconOverlayHandlerBase : IShellIconOverlayIdentifier
    {
    }

Look up the GUID in the Assembly Information:

Use this GUID value in the [GUID] directive


    // This is set to false as we should not attempt to register this assembly with COM
    [ComVisible(false)]
    [Guid("e30a995d-1578-46f1-80ca-d11e5372be4d")]
    public class MyIconOverlayHandlerBase : IShellIconOverlayIdentifier
    {
    }

Implement Class Properties:

        #region Class Properties

        protected virtual string OverlayIconFilePath
        {
            get
            {
                return Path.Combine(
                     new string[] { Path.GetPathRoot(Environment.SystemDirectory),
                                    "ProgramData",
                                    "IconOverlayTest" }).ToLowerInvariant();
            }
        }

        protected string TargetDirectory
        {
            get
            {
                return Path.Combine(
       new string[] {         Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                                    "IconOverlayTest" }).ToLowerInvariant();
            }
        }

        protected virtual int Priority
        {
            get
            {
                return 0;  // 0-100 (0 is highest priority)
            }
        }

        protected virtual string FileNameStart
        {
            get
            {
                return string.Empty;
            }
        }

        #endregion Class Properties

Implement IShellIconOverlayIdentifier Interface:

#region IShellIconOverlayIdentifier Members

        public int IsMemberOf(string path, uint attributes)
        {
            if (!path.ToLowerInvariant().StartsWith(TargetDirectory) || path.ToLowerInvariant().Equals(TargetDirectory))
            {
                unchecked
                {
                    return (int)HRESULT.S_FALSE;
                }
            }

            try
            {
                unchecked
                {
                    return
                        Path.GetFileName(path).StartsWith(FileNameStart , StringComparison.InvariantCultureIgnoreCase) ?
                        (int)HRESULT.S_OK :
                        (int)HRESULT.S_FALSE;
                }
            }
            catch
            {
                unchecked
                {
                    return (int)HRESULT.E_FAIL;
                }
            }
        }

        public int GetOverlayInfo(IntPtr iconFileBuffer, int iconFileBufferSize, out int iconIndex, out uint flags)
        {
            string fname = OverlayIconFilePath;

            int bytesCount = System.Text.Encoding.Unicode.GetByteCount(fname);

            byte[] bytes = System.Text.Encoding.Unicode.GetBytes(fname);

            if (bytes.Length + 2 < iconFileBufferSize)
            {
                for (int i = 0; i < bytes.Length; i++)
                {
                    Marshal.WriteByte(iconFileBuffer, i, bytes[i]);
                }
                //write the "\0\0"
                Marshal.WriteByte(iconFileBuffer, bytes.Length, 0);
                Marshal.WriteByte(iconFileBuffer, bytes.Length + 1, 0);
            }

            iconIndex = 0;
            flags = (int)(HFLAGS.ISIOI_ICONFILE | HFLAGS.ISIOI_ICONINDEX);
            return (int)HRESULT.S_OK;
        }

        public int GetPriority(out int priority)
        {
            priority = Priority;
            return (int)HRESULT.S_OK;
        }

        #endregion IShellIconOverlayIdentifier Members

Add ShellInterop class to MyIconOverlayHandlers namespace to handle COM registration:

        public sealed class ShellInterop
    {
        private ShellInterop()
        {
        }

        [DllImport("shell32.dll")]
        public static extern void SHChangeNotify(int eventID, uint flags, IntPtr item1, IntPtr item2);
    }

Add Register and Unregister methods to MyIconOverlayHandlerBase class:

#region Registry

        [ComRegisterFunction]
        public static void Register(Type t)
        {
            RegistryKey rk = Registry.LocalMachine.CreateSubKey
(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\" + t.Name);
            rk.SetValue(string.Empty, t.GUID.ToString("B").ToUpper());
            rk.Close();
            ShellInterop.SHChangeNotify(0x08000000, 0, IntPtr.Zero, IntPtr.Zero);
        }

        [ComUnregisterFunction]
        public static void Unregister(Type t)
        {
            Registry.LocalMachine.DeleteSubKeyTree(
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers\" + t.Name);
            ShellInterop.SHChangeNotify(0x08000000, 0, IntPtr.Zero, IntPtr.Zero);
        }

        #endregion Registry

Rebuild the solution in debug mode.

f. Implement Child Classes

As the base MyIconOverlayHandlerBase class provides implementation of IShellIconOverlayIdentifier interface and handles assembly registration, implementation of the child classes is extremely simple: all that’s required is overriding FileName start property to specify the file name prefix and OverlayIconFilePath property to provide the path to the corresponding overlay icon.

MyIconOverlayHandlersAdded

Change the assembly name to AMyIconOverlayHandlerAdded to insure the OS invokes the assembly before others, in the alphabetical order, just as the registration keys are sorted in ShellIconOverlayIdentifiers registration subfolder:

Override OverlayIconFilePath and FileNameStart class properties:

using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
using MyIconOverlayHandlers;

namespace MyIconOverlayHandlersAdded
{
    [ComVisible(true)]
    [Guid("3a5e8b82-c28a-4ff7-b1cd-5bb42a7c404d")]
    public class AMyIconOverlayHandlersAdded : MyIconOverlayHandlerBase
    {
        #region Class Properties

        protected override string OverlayIconFilePath
        {
            get
            {
                return Path.Combine(base.OverlayIconFilePath, @"AddedOverlay.ico");
            }
        }

        protected override string FileNameStart
        {
            get
            {
                return "added";
            }
        }

        #endregion Class Properties
    }
}

MyIconOverlayHandlersConflict

Change the assembly name to AMyIconOverlayHandlersConflict

Override OverlayIconFilePath and FileNameStart class properties:


using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
using MyIconOverlayHandlers;

namespace MyIconOverlayHandlersConflict
{
    [ComVisible(true)]
    [Guid("0cb8cec6-d3ec-43b0-89b0-73f42048e4e8")]
    public class AMyIconOverlayHandlersConflict: MyIconOverlayHandlerBase
    {
        #region Class Properties

        protected override string OverlayIconFilePath
        {
            get
            {
                return Path.Combine(base.OverlayIconFilePath, @"ConflictOverlay.ico");
            }
        }

        protected override string FileNameStart
        {
            get
            {
                return "conflict";
            }
        }

        #endregion Class Properties
    }
}

MyIconOverlayHandlersDeleted

Change the assembly name to AMyIconOverlayHandlersDeleted

Override OverlayIconFilePath and FileNameStart class properties:


using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.IO;
using MyIconOverlayHandlers;

namespace MyIconOverlayHandlersDeleted
{
    [ComVisible(true)]
    [Guid("10ea42c8-73e0-4129-828d-35fc47fc2ebf")]
    public class AMyIconOverlayHandlersDeleted : MyIconOverlayHandlerBase
    {
        #region Class Properties

        protected override string OverlayIconFilePath
        {
            get
            {
                return Path.Combine(base.OverlayIconFilePath, @"DeletedOverlay.ico");
            }
        }

        protected override string FileNameStart
        {
            get
            {
                return "deleted";
            }
        }

        #endregion Class Properties
    }
}

4. Register Icon Overlay Handlers

First of all, make sure that AddedIcon.ico, ConflictIcon.ico and DeletedIcon.ico icon files to be used for overlays
are indeed inside the {Environment.SystemDirectory}/ProgramData/IconOverlayTest
folder.

Once you’ve compiled your code, register the assemblies using RegAsm.exe tool.

Open three command prompts with admin privileges (select Run as administrator option)

Navigate to the output directories of MyIconOverlayHandlersAdded, MyIconOverlayHandlersConflict and MyIconOverlayHandlersDeleted projects:

{Project Folder}\MyIconOverlayHandlersAdded\bin\Debug

{Project Folder}\MyIconOverlayHandlersConflict\bin\Debug

{Project Folder}\MyIconOverlayHandlersDeleted\bin\Debug

Register the assemblies with the following command:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe AMyIconOverlayHandlersAdded.dll /codebase

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe AMyIconOverlayHandlersConflict.dll /codebase

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe AMyIconOverlayHandlersDeleted.dll /codebase

Note, you may get the below warning message if you ignored signing the assemblies:

Check the contents of the SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers registry subfolder using regedit.exe. You should have three corresponding entries with Data values matching type GUID. The name of the registry setting is the type name, i.e. the class name.

Kill the explorer.exe process in the Windows Task Manager and restart the Windows Explorer by selecting File – New Task (Run…):

Restarting the Explorer will cause it to load all registered resources, including the image overlay handlers. This is the only time when GetOverlayInfo and GetPriority methods of IShellIconOverlayIdentifier interface get invoked. The overlay icons get loaded into the system image list and no further changes to the icons is possible from this point on, i.e. you can’t force the Explorer to update the overlay icon once the start-up is completed.

Navigate to {Environment.SpecialFolder.UserProfile}/IconOverlayTest folder and create three text files naming them added.txt, conflict.txt and deleted.txt. You should observe icon overlays:

Change the view option in the Explorer from List to Tiles and notice that higher-resolution icons are now used for overlays:

To unregister the handlers, use the /u command option instead of /codebase (you may need to do so in order to recompile your solution):

This will remove the registry entry. To complete deregistration, restart the Explorer.

5. Debug Icon Overlay Handlers

You can debug your code by attaching the debugger to explorer.exe process:

Debugging can only start once the assemblies have been compiled in debug mode and registered with RegAsm.exe tool and the Windows Explorer restarted. This has an unfortunate side-effect: it does not seem to be possible to debug the code inside GetOverlayInfo or GetPriority members of IShellIconOverlayIdentifier interface as these methods are only invoked during the instantiation of the explorer.exe process.

Tagged , , , , , , , , ,

Best Programming Practices: Avoid Magic Strings when Implementing INotifyPropertyChanged Interface

This post will discuss alternative approaches to using “magic strings”, i.e. hardcoding names of class properties or other class attributes.

It’s a rather common practice to use “magic strings” when implementing a INotifyPropertyChanged interface in Silverlight and WPF applications. Below is a typical implementation of the interface:

// This is a simple customer class that 
// implements the IPropertyChange interface.
public class DemoCustomer : INotifyPropertyChanged
{
    // These fields hold the values for the public properties.
    private Guid idValue = Guid.NewGuid();
    private string customerNameValue = String.Empty;
    private string phoneNumberValue = String.Empty;

    public event PropertyChangedEventHandler PropertyChanged;

    private void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }

    // The constructor is private to enforce the factory pattern.
    private DemoCustomer()
    {
        customerNameValue = "Customer";
        phoneNumberValue = "(555)555-5555";
    }

    // This is the public factory method.
    public static DemoCustomer CreateNewCustomer()
    {
        return new DemoCustomer();
    }

    // This property represents an ID, suitable
    // for use as a primary key in a database.
    public Guid ID
    {
        get
        {
            return this.idValue;
        }
    }

    public string CustomerName
    {
        get
        {
            return this.customerNameValue;
        }

        set
        {
            if (value != this.customerNameValue)
            {
                this.customerNameValue = value;
                NotifyPropertyChanged("CustomerName");
            }
        }
    }

    public string PhoneNumber
    {
        get
        {
            return this.phoneNumberValue;
        }

        set
        {
            if (value != this.phoneNumberValue)
            {
                this.phoneNumberValue = value;
                NotifyPropertyChanged("PhoneNumber");
            }
        }
    }
}

Notice that property names (“CustomerName” and “PhoneNumber”) are hardcoded, leaving room for typing mistakes, which can only be identified via extensive runtime testing.

The problem may not be confined to the class implementing the interface alone: it is also a common practice to hardcode the property names in the classes which subscribe to the PropertyChanged event defined by the interface. Needless to say, maintaining cohesion in such cases can become a daunting task.

A better approach would be to define class property names as a public enum:

public class DemoCustomer  : INotifyPropertyChanged
{

…
    public enum PropertyNames
    {
       CustomerName,
       PhoneNumber
    }

    public string CustomerName
    {
        get
        {
            return this.customerNameValue;
        }

        set
        {
            if (value != this.customerNameValue)
            {
                this.customerNameValue = value;
                NotifyPropertyChanged(Enum.GetName(typeof(PropertyNames), PropertyNames. CustomerName));
            }
        }
    }

    public string PhoneNumber
    {
        get
        {
            return this.phoneNumberValue;
        }

        set
        {
            if (value != this.phoneNumberValue)
            {
                this.phoneNumberValue = value;
                NotifyPropertyChanged(Enum.GetName(typeof(PropertyNames), PropertyNames. PhoneNumber));
            }
        }
    }
}

A much better solution would be to use lambda expressions to represent the property name

// This is a simple customer class that 
// implements the IPropertyChange interface.
public class DemoCustomer  : INotifyPropertyChanged
{
    // These fields hold the values for the public properties.
    private Guid idValue = Guid.NewGuid();
    private string customerNameValue = String.Empty;
    private string phoneNumberValue = String.Empty;

    public event PropertyChangedEventHandler PropertyChanged;

    private void NotifyPropertyChanged(String info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }

    private void NotifyPropertyChanged <TProperty>(Expression<Func<TProperty>> property)
    {
        var lambda = (LambdaExpression)property;
        MemberExpression memberExpression;
        if (lambda.Body is UnaryExpression)
        {
            var unaryExpression = (UnaryExpression)lambda.Body;
            memberExpression = (MemberExpression)unaryExpression.Operand;
        }
        else 
        {
	    memberExpression = (MemberExpression)lambda.Body;
        }
        NotifyPropertyChanged(memberExpression.Member.Name);
    }

    // The constructor is private to enforce the factory pattern.
    private DemoCustomer()
    {
        customerNameValue = "Customer";
        phoneNumberValue = "(555)555-5555";
    }

    // This is the public factory method.
    public static DemoCustomer CreateNewCustomer()
    {
        return new DemoCustomer();
    }

    // This property represents an ID, suitable
    // for use as a primary key in a database.
    public Guid ID
    {
        get
        {
            return this.idValue;
        }
    }

    public string CustomerName
    {
        get
        {
            return this.customerNameValue;
        }

        set
        {
            if (value != this.customerNameValue)
            {
                this.customerNameValue = value;
                NotifyPropertyChanged(() => CustomerName);
            }
        }
    }

    public string PhoneNumber
    {
        get
        {
            return this.phoneNumberValue;
        }

        set
        {
            if (value != this.phoneNumberValue)
            {
                this.phoneNumberValue = value;
                NotifyPropertyChanged(() => PhoneNumber);
            }
        }
    }
}
Tagged , , , ,

Passing Multiple Parameters to a Value Converter in Silverlight 5

In this post, I will attempt to describe a useful technique of implementing value converters. In order to ensure a degree of reusability and integration with XAML, converter parameter values will be declared in XAML, either on the page where the converter is used or in the global resource dictionary. The post will discuss limitations of Silverlight 5 which are non-existent in WPF and ways of overcoming these limitations.

Both IValueConverter and IMultiValueConverter interfaces define two methods, Convert and ConvertBack, none of which accepts multiple parameters per say:

interface IValueConverter 
{ 
public object Convert(object value, Type targetType, object parameter, CultureInfo culture); 
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture); 
}

and

 
interface IMultiValueConverter 
{ 
	public object Convert(object value, Type targetType, object parameter, CultureInfo culture); 
	public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture); 
} 

respectively

The third parameter of the Convert and ConvertBack methods is an object, thus facilitating passing either an instance of a class extending Object, an Array or a Collection, which is straight forward when done in code-behind. However, this presents a challenge when the converter parameter has to be defined in XAML.

For instance, you may want to implement a simple converter to display an appropriate icon in the data grid cell, at the same time setting the background of the cell based on the data value. The logical place to define the range of values and the corresponding icons and colors would be in XAML.

The use of

 
<x:Array Type="sys:String" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <sys:String>Hello</sys:String>
  <sys:String>World</sys:String>
</x:Array>

markup extension seems like an easy way out. However, unlike WPF, Silverlight does not support the Array extension.

The natural Silverlight way of defining your resource is the ResourceDictionary class, a keyed dictionary of objects that can be used both in XAML and in code:

<navigation:Page 
	...>

   <UserControl.Resources>
 
        <ResourceDictionary x:Key="backgroundConverterParams"
  	  xmlns:sys="clr-namespace:System;assembly=mscorlib">
  	  <sys:String x:Key="Pos">Coral</sys:String>
  	  <sys:String x:Key="Zero">LightGreen</sys:String>
          <sys:String x:Key="Neg">LightGreen</sys:String>
	</ResourceDictionary >

	<ResourceDictionary x:Key="iconConverterParams"
   	   xmlns:sys="clr-namespace:System;assembly=mscorlib">
   	   <sys:String x:Key="Pos">/MyProject;component/Assets/Images/Buttons/16/Cross.png</sys:String>
   	   <sys:String x:Key="Zero">/MyProject;component/Assets/Images/Buttons/16/Tick.png</sys:String>
   	   <sys:String x:Key="Neg">/MyProject;component/Assets/Images/Buttons/16/Tick.png</sys:String>
	</ResourceDictionary >

   </UserControl.Resources>

Implement the IValueConverter interface:

 
namespace MyNamespace
{
   public class MyConverter: IValueConverter
   {
        /// <summary>
        /// Converts <c>null</c> or empty strings to <c>null</c>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        /// <param name="targetType">The expected type of the result (ignored).</param>
        /// <param name="parameter">Optional parameter (ignored).</param>
        /// <param name="culture">The culture for the conversion (ignored).</param>
        /// <returns>If the <paramref name="value"/>is <c>null</c> or empty, this method returns <c>null</c> otherwise it returns the <paramref name="value"/>.</returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            int count = System.Convert.ToInt32(value);

            ResourceDictionary resources = (ResourceDictionary)parameter;

            if (count < 0)
                return resources["Neg"];
            else if (count == 0)
                return resources["Zero"];
            else
                return resources["Pos"];
        }

        /// <summary>
        /// Converts <c>null</c> back to <see cref="String.Empty"/>.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        /// <param name="targetType">The expected type of the result (ignored).</param>
        /// <param name="parameter">Optional parameter (ignored).</param>
        /// <param name="culture">The culture for the conversion (ignored).</param>
        /// <returns>If <paramref name="value"/> is <c>null</c>, it returns <see cref="String.Empty"/> otherwise <paramref name="value"/>.</returns>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
   }
}

Compile your code and declare the MyNamespace namespace in XAML:

 
<navigation:Page 
	...
	xmlns:myNamespace="clr-namespace:MyNamespace"
	...>

Add an instance of the value converter to the datagrid resources:

 
<c1:C1DataGrid.Resources>
   <myNamespace:MyConverter x:Key="myConverter" />
</c1:C1DataGrid.Resources>

Add an instance of the value converter to the datagrid resources:

 
<c1:DataGridTemplateColumn
   Name="StatusColumn"
   Header="Status"
   Width="52"
   HorizontalAlignment="Center"
   VerticalAlignment="Center">
   <c1:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
         <Grid Background="{Binding Path=FailedRecordsCount, Converter={StaticResource myConverter}, ConverterParameter={StaticResource backgroundConverterParams}}">
            <Image
               VerticalAlignment="Center"
               HorizontalAlignment="Center"
               Stretch="None"
               Source="{Binding Path=FailedRecordsCount, Converter={StaticResource myConverter}, ConverterParameter={StaticResource iconConverterParams}}" />
         </Grid>
      </DataTemplate>
   </c1:DataGridTemplateColumn.CellTemplate>
</c1:DataGridTemplateColumn>
Tagged , , , , , , ,

Selecting Records Satisfying Selection Criteria over Groups of Records

This post will analyze the use of PARTITION BY and OVER Clause (Transact-SQL) in an SQL query to select records satisfying selection criteria over groups of records.

A rather common task of selecting a number of records satisfying selection criteria over a group of records can be solved by using the OVER Clause (Transact-SQL) and an analytic function such as PARTITION BY Clause:

SELECT
 *
FROM
 (
	SELECT 
			row_number() 
		OVER 
			(PARTITION BY 
				{Partition_Criteria} 
			ORDER BY 
				{Ordering_Criteria}  DESC) 
	AS rnum,
	*
	FROM 
		{Table_or_View}
	) AS it
	WHERE 
		rnum = 1 

In contrast to the aggregate GROUP BY clause, the analytic PARTITION BY clause does not roll up the data. Instead, the result set is divided into partitions over which the window function is applied separately. The total number of the records returned is therefore not affected, which facilitates further selection criteria.

row_number() function can be used to get an identity column which will reset for each partition.

For example, the following query can be used to return the latest customer orders:

SELECT
 Customer_Orders.*
FROM
 (
	SELECT 
			row_number() 
		OVER 
			(PARTITION BY 
				Customer_Orders.CustomerId
			ORDER BY 
				{Customer_Orders.OrderCreatedDateTime}  DESC) 
	AS rnum,
	*
	FROM 
		{Customer_Orders}
	) AS it
	WHERE 
		rnum = 1
Tagged , , ,

Identifying Unique Node Combination Using External Assembly Script

In this blog I’ll illustrate how to create a node in a destination document for each unique node combination in a source document. As you may be well aware, this kind of transformation cannot be accomplished by using the BizTalk mapper alone. We will have to resort to using a custom XSLT transformation and C# script, compiled in an external assembly for reusability.

In this mapping exercise, we’ll create the <Item> segment in the destination document for each Material/Batch/VGPOS node combination in the source document. Each <Item> node is to be assigned a sequential ID stored in the <ItemID> node.

Implementation steps are as follows:

  1. Configure BizTalk mapper to use custom XSLT.
  2. Add Helper class library to your solution.
  3. Add MapHelper class to the class library. An instance of this class will be used to identify unique Material/Batch/VGPOS node combinations in the source schema.
  4. Add CounterHelper class to the class library. An instance of this class will be used for numbering purposes.
  5. In the custom XSLT
    1. Instantiate MapHelper  and CounterHelper classes
    2. Loop though the nodes in the source schema
    3. For each source node, construct a key concatenating the values of Material, Batch, VGPOS nodes
    4. Use the instance of MapHelper class to check if the the Material/Batch/VGPOS combination has not been encountered before. Should this be the case
      1. Create <Item> node in the destination schema.
      2. Use the instance of CounterHelper class to generate the sequential ID to be stored in <ItemID> node.

Note that a unique instance ID has to be passed in the AddInstance function call of both MapHelper and CounterHelper classes This is necessary as there can be multiple instances of the transform running concurrently in BizTalk server. Such instances will use the same instance of MapHelper and CounterHelper classes.

The implementation of MapHelper and CounterHelper classes are as follows:

using System;
using System.Collections;
using System.Text;
using System.Collections.Specialized;

namespace Helper
{
    public class MapHelper
    {
        private static System.Collections.Hashtable _index = null;

        static MapHelper()
        {
            _index = new System.Collections.Hashtable();
        }

        public void AddInstance(string instanceId)
        {
            _index.Add(instanceId, new System.Collections.Hashtable());
        }

        public void ClearInstance(string instanceId)
        {
            _index.Remove(instanceId);
        }

        public bool Exists(string instanceId, string key)
        {
            Hashtable collection = (Hashtable)_index[instanceId];

            if (collection == null)
            {
                collection = new Hashtable();
                _index.Add(instanceId, collection);
            }

            if (collection.Contains(key))
            {
                return true;
            }
            else
            {
                collection.Add(key, key);
                return false;
            }
        }

        public string GetKey(string primaryKey, string secondaryKey)
        {
            return (string.IsNullOrEmpty(primaryKey) || string.IsNullOrEmpty(primaryKey.Trim())) ? secondaryKey : primaryKey;
        }
    }
}

 

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace Helper
{
    public class CountHelper
    {
        private static Hashtable _index = null;

        public CountHelper()
        {
            _index = new System.Collections.Hashtable();
        }

        public void AddInstance(string instanceId)
        {
            _index.Add(instanceId, 0);
        }

        public void ClearInstance(string instanceId)
        {
            if(_index.ContainsKey(instanceId))
                _index.Remove(instanceId);
        }

        public int GetCurrentValue(string instanceId)
        {
            return (int)_index[instanceId];
        }

        public void IncrementCounter(string instanceId)
        {
            _index[instanceId] = (int)_index[instanceId] + 1;
        }

        public void ResetCounter(string instanceId)
        {
            _index[instanceId] = 0;
        }
    }
}

The use of MapHelper and CounterHelper classes in the custom XSLT is demonstrated below:

<ExtensionObjects>
   <ExtensionObject Namespace="http://schemas.microsoft.com/BizTalk/2003/ScriptNS1" AssemblyName="Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecc9f17fdca0d677" ClassName="Helper.CountHelper" />
  <ExtensionObject Namespace="http://schemas.microsoft.com/BizTalk/2003/ScriptNS2" AssemblyName="Helper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ecc9f17fdca0d677" ClassName="Helper.MapHelper" />
</ExtensionObjects>
<?xml version="1.0" encoding="UTF-16"?>
<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
	xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
	xmlns:var="http://schemas.microsoft.com/BizTalk/2003/var" 
	exclude-result-prefixes="msxsl var s4 s0 s3 s1 s2 s5 userCSharp ScriptNS1 ScriptNS2" 
	version="1.0" 
	xmlns:s3="http://schemas.microsoft.com/BizTalk/2003/aggschema" 
	xmlns:ns0="urn:inventoryandwarehousemanagement" 
	xmlns:s0="http://Microsoft.LobServices.Sap/2007/03/Idoc/3/DELVRY03/ZSHPCONX2/701/Receive" 
	xmlns:s2="http://Internal/Configuration/v1.0" 
	xmlns:p6="urn:common" 
	xmlns:s4="http://Microsoft.LobServices.Sap/2007/03/Types/Idoc/Common/" 
	xmlns:s5="http://Microsoft.LobServices.Sap/2007/03/Types/Idoc/3/DELVRY03/ZSHPCONX2/701" 
	xmlns:s1="http://www.linfox.com/Fonterra/Catalyst/Schema/Internal/Translation/v1.0" 
	xmlns:userCSharp="http://schemas.microsoft.com/BizTalk/2003/userCSharp" 
	xmlns:ScriptNS1="http://schemas.microsoft.com/BizTalk/2003/ScriptNS1"
	xmlns:ScriptNS2="http://schemas.microsoft.com/BizTalk/2003/ScriptNS2">
  <xsl:output omit-xml-declaration="yes" method="xml" version="1.0" />

  <xsl:template match="/">
    <xsl:variable name="mapInstanceId" select="/s3:Root/InputMessagePart_0/s2:Configuration/Common/ActivityID/text()" />
	  
    <xsl:variable name="instanceId1" select="ScriptNS2:ClearInstance($mapInstanceId)" />
    <xsl:variable name="instanceId2" select="ScriptNS2:AddInstance($mapInstanceId)" />

    <xsl:variable name="counterInstanceId1" select="ScriptNS1:ClearInstance($mapInstanceId)" />
    <xsl:variable name="counterInstanceId2" select="ScriptNS1:AddInstance($mapInstanceId)" />
	  
    <xsl:apply-templates select="/s3:Root" />

    <xsl:variable name="instanceId3" select="ScriptNS2:ClearInstance($mapInstanceId)" />
    <xsl:variable name="counterInstanceId3" select="ScriptNS1:ClearInstance($mapInstanceId)" /> 
  </xsl:template>

  <xsl:template match="/s3:Root">
    
    <xsl:variable name="mapInstanceId" select="InputMessagePart_0/s2:Configuration/Common/ActivityID/text()" />
  
    <ns0:InboundDeliveryWarehouseConfirmation>
      
      <InboundDelivery>

        <xsl:value-of select="ScriptNS1:ResetCounter($mapInstanceId)"/> 
		  
        <xsl:for-each select="InputMessagePart_1/s0:Receive/s0:idocData">
          <xsl:for-each select="s5:E2EDL20003GRP">
            <xsl:for-each select="s5:E2EDL24007GRP/s5:E2EDL24007">
              <xsl:variable name="currentVGPOS" select="s5:VGPOS/text()" />  
              <xsl:variable name="currentMaterialId" select="s5:MATNR/text()" />
              <xsl:variable name="currentBatch" select="s5:CHARG/text()" />
					  
              <xsl:if test="ScriptNS2:Exists($mapInstanceId, concat($currentVGPOS,'|',$currentBatch, '|', $currentMaterialId)) = false">
				  
              <xsl:value-of select="ScriptNS1:IncrementCounter($mapInstanceId)"/>
                <Item>
                  <ItemID>
                    <xsl:value-of select="ScriptNS1:GetCurrentValue($mapInstanceId)"/>
                  </ItemID>
                </Item>
              </xsl:if>
            </xsl:for-each>
          </xsl:for-each>
        </xsl:for-each>
		
      </InboundDelivery>
    </ns0:InboundDeliveryWarehouseConfirmation>
  </xsl:template>
</xsl:stylesheet>
Tagged , , , , , , ,

Using CForwardOnlyEventingReadStream for Message Archving

It is a rather common practice to rely on Microsoft.BizTalk.Streaming.CForwardOnlyEventingReadStream when implementing BizTalk message archiving pipeline components:


        #region IComponent members

        /// <summary>
        /// Implements IComponent.Execute method.
        /// </summary>
        /// <param name="context">Pipeline context</param>
        /// <param name="inMsg">Input message</param>
        /// <returns>Original input message</returns>
        /// <remarks>
        /// IComponent.Execute method is used to initiate
        /// the processing of the message in this pipeline component.
        /// </remarks>
        public IBaseMessage Execute(IPipelineContext context, IBaseMessage message)
        {
            //this method should always catch exceptions internally and write to the event log where SCOM should pick it up
            //archiving failures should never stop message processing...
            try
            {
                if (ArchivingEnabled)
                {
                    if (string.IsNullOrEmpty(ArchiveDirectory) ||string.IsNullOrEmpty(ArchiveFilename))
                    {
                        throw new Exception("Archive Directory and/or Archive Filename cannot be empty.");
                    }
                    
                    if (message.BodyPart != null)
                    {
                        // Expand macros and build the archive file path.
                        _archiveFilePath = BuildArchiveFilePath(message);

                        // Add the archive file-path to the Message Context.
                        message.Context.Write("ArchiveFileName", LINFOX_PIPELINE_NAMESPACE, _archiveFilePath);

                        // Create a Forward-Only Eventing Stream.
                        message.BodyPart.Data = CreateForwardOnlyEventingStream(message.BodyPart.GetOriginalDataStream());


                    }
                    else
                    {
                        System.Diagnostics.EventLog.WriteEntry(EVENT_LOG_SOURCE, "Could not archive message - the body part is null.", EventLogEntryType.Error, (int)EventData.BizTalkMessageValidation.BodyPartIsNull);
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry(EVENT_LOG_SOURCE, String.Format("An error occured creating the archive file at {0}.\n\nThe following error was raised: {1}", ArchiveDirectory, ex.Message), EventLogEntryType.Error, (int)EventData.ArchiveFileWriteFailures.GeneralExceptionWritingArchiveFile);
            }
            finally
            {
                if (message.BodyPart.Data.CanSeek)
                    message.BodyPart.Data.Seek(0, SeekOrigin.Begin);

            }
            
            return (message);
        }

        /// <summary>
        /// Create a forward-only eventing stream.
        /// </summary>
        /// <param name="originalStream">Stream containing the original data stream.</param>
        /// <returns>Stream wrapped forward-only eventing stream.</returns>
        private Stream CreateForwardOnlyEventingStream(Stream originalStream)
        {
            DeleteExistingArchiveFile();

            // Create the forward-only eventing stream
            CForwardOnlyEventingReadStream eventingStream = new CForwardOnlyEventingReadStream(originalStream);
            eventingStream.ReadEvent += StreamOnReadEvent;

            return (eventingStream);
        }

        /// <summary>
        /// Delete the archive file if it already exists and the component has been configured to overwrite.
        /// </summary>
        private void DeleteExistingArchiveFile()
        {
            if (File.Exists(_archiveFilePath) && OverwriteExistingFile)
            {
                File.Delete(_archiveFilePath);
            }
        }

        /// <summary>
        /// Stream 'On Read Event'. Called as downstream components or the BizTalk Messaging Agent itself 
        /// reads the message. This method spools the portion of the stream read to disk. An 'optimised' copy.
        /// </summary>
        /// <param name="src"></param>
        /// <param name="args"></param>
        private void StreamOnReadEvent(object src, EventArgs args)
        {
            ReadEventArgs rargs = args as ReadEventArgs;

            if (rargs != null)
            {
                try
                {
                    using (
                        FileStream FileArchiveStream =
                            new FileStream(_archiveFilePath, FileMode.Append, FileAccess.Write))
                    {
                        using (BinaryWriter FileBinaryWriter = new BinaryWriter(FileArchiveStream))
                        {
                            FileBinaryWriter.Write(rargs.buffer, rargs.offset, rargs.bytesRead);

                            // Close the file writer.
                            FileBinaryWriter.Flush();
                            FileBinaryWriter.Close();
                        }
                    }
                }
                catch (IOException Ex)
                {
                    System.Diagnostics.EventLog.WriteEntry(EVENT_LOG_SOURCE, String.Format("An error occured creating the archive file at {0}.\n\nThe following error was raised: {1}", _archiveFilePath, Ex.Message), EventLogEntryType.Error, (int)EventData.ArchiveFileWriteFailures.ArchiveFileFailedToWrite);
                }
                catch (Exception Ex)
                {
                    System.Diagnostics.EventLog.WriteEntry(EVENT_LOG_SOURCE, String.Format("An error occured creating the archive file at {0}.\n\nThe following error was raised: {1}", _archiveFilePath, Ex.Message), EventLogEntryType.Error, (int)EventData.ArchiveFileWriteFailures.GeneralExceptionWritingArchiveFile);
                }
            }
            else
            {
                // Supplied event arguements are null.
                System.Diagnostics.EventLog.WriteEntry(EVENT_LOG_SOURCE, String.Format("An error occured creating the archive file at {0}.\n\nThe stream OnRead event did not contain Event Args, the archive file cannot be written.", _archiveFilePath), EventLogEntryType.Error, (int)EventData.ArchiveFileWriteFailures.EventArgsAreNull);
            }
        }

At first glance, this approach offers improved efficiency over performing an immediate copy of the message contents: the contents are written to the archive file asynchronously, in chunks, as the message contents are read by other BizTalk components.

However, the asynchronous nature of this solution and the reliance on the function of other BizTalk components accessing the same data stream is the downfall of this approach:

The archiving pipeline component may write only a fraction of the message should the CForwardOnlyEventingReadStream be closed prior to the message is read fully

Consider an implementation of a receive pipeline below:

Notice that the pipeline included a custom pipeline component MessageValidator which will attempt to validate the incoming XML document against the schema:


        public bool ValidateDocument(Stream inputStream, XmlSchema xmlSchema)
        {
            XmlReader reader = null;
            try
            {
                // Set up XML validating reader and validate document                   
                XmlReaderSettings settings = new XmlReaderSettings();
                settings.Schemas.Add(xmlSchema);
                settings.ValidationType = ValidationType.Schema;
                settings.ValidationEventHandler += new ValidationEventHandler(ValidationHandler);
                reader = XmlReader.Create(inputStream, settings);

                while (reader.Read()) ;
            }
            catch (Exception ex)
            {
                m_logger.LogError(
                    string.Format("Unexpected exception occured in ValidateDocument method \r\n {0}:", ex));
            }
            return m_IsValid;
        }
        private void ValidationHandler(object sender, ValidationEventArgs e)
        {
            try
            {
                m_ErrorMessage.AppendFormat("{0}{1}",e.Message,System.Environment.NewLine);
                m_IsValid = false;
            }
            catch (Exception ex)
            {
                m_logger.LogError(
                    string.Format("Unexpected exception occured in ValidateDocument-->ValidationHandler \r\n {0}:", ex));

            }
        }

Most XML parsers will give up after the first error in a document. In fact, IIRC, that’s actually part of the ‘official’ spec for parsers: Once a fatal error is detected, however, the processor must not continue normal processing (i.e., it must not continue to pass character data and information about the document’s logical structure to the application in the normal way).

This has an adverse effect on message archiving: when certain conditions are met, such as

  1. The message is either not a well-formed xml or the message does not pass the schema validation
  2. The message is large and is read in chunks

you will end up with only a part of your incoming message archived!

Do not take the forward only nature of the CForwardOnlyEventingReadStream stream for granted:

Consider the following implementation of a send pipeline:

Once again, the Message Archiver pipeline component is followed by another pipeline component which may influence how the data steam is accessed. Some implementations of CForwardOnlyEventingReadStream-based archiving pipeline components take ForwardOnly-ness of the steam too literally:

        /// <summary>
        /// Stream 'On Read Event'. Called as downstream components or the BizTalk Messaging Agent itself 
        /// reads the message. This method spools the portion of the stream read to disk. An 'optimised' copy.
        /// </summary>
        /// <param name="src"></param>
        /// <param name="args"></param>
        private void StreamOnReadEvent(object src, EventArgs args)
        {
            ReadEventArgs rargs = args as ReadEventArgs;

            if (rargs != null)
            {
                try
                {
                    using (
                        FileStream FileArchiveStream =
                            new FileStream(_archiveFilePath, FileMode.Append, FileAccess.Write))
                    {
                        using (BinaryWriter FileBinaryWriter = new BinaryWriter(FileArchiveStream))
                        {
                            FileBinaryWriter.Write(rargs.buffer, 0, rargs.bytesRead);

Note the 0 passed as the index parameter in the BinaryWriter Write method, which is relying on message contents being read in the forwar-only manner… Some BizTalk compoments, such as AS2 encoder, do not conform to this general rule though. The fix to this issue is simple:

   FileBinaryWriter.Write(rargs.buffer, rargs.offset, rargs.bytesRead);

Despite the above limitations of the using the CForwardOnlyEventingReadStream for archiving purposes, it is still the preferred method due to efficiency considerations. While there is an easy fix to overcome the effect of the message not being read in the strictly forward matter, I am still to find a way out of a situation when the message is not read fully…

Tagged , , , , , , , ,
Follow

Get every new post delivered to your Inbox.