Data Cogs Information Technology

posts - 131, comments - 251, trackbacks - 36

General

Search This Site

Powered by Google

Brisbane

Locations of visitors to this page

Information

Archives

Images

Blogs

CV etc.

Links For Me

I finally figured out how to pass an array of facts into the Rules Engine that comes with BizTalk 2004.  (Since the XLangs syntax does not directly support arrays, see http://datacogs.com/datablogs/archive/2004/12/04/183.aspx )The trick is to use the ToArray method of the ArrayList class.  Simple when you know how, but guaranteed to give hours of head-scratching if you don't.   I will post a more “step-by-step“ article when I get some time.

Here is the code from the Expression shape that does all the work.  (The variables are declared within an atomic scope shape in the orchestration)

//System.Collections.ArrayList List;
sCon = "Initial Catalog=Northwind;Data Source=(local);Integrated Security=SSPI;";
con = new System.Data.SqlClient.SqlConnection(sCon);
dcNorthwind = new Microsoft.RuleEngine.DataConnection("Northwind", "ShipperCountry", con);
List.Add(dcNorthwind);

xmlDocument = msgShippingRequest;
typedXmlDocument = new Microsoft.RuleEngine.TypedXmlDocument("RoleLinkSample.ShippingRequest",xmlDocument);
policy = new Microsoft.RuleEngine.Policy("ShippingPolicy");
List.Add(typedXmlDocument);

policy.Execute(List.ToArray());
msgOutgoingShippingRequest = typedXmlDocument.Document;
policy.Dispose();
typedXmlDocument = null;
dcNorthwind = null;

posted on Thursday, February 03, 2005 9:09 AM

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Url
Comment   
Protected by Clearscreen.SharpHIPEnter the code you see: