问题
It seems that Biztalk only supports making rules via the Business Rules Composer, a design-time tool.
Everywhere I see "programmatic" referring to Biztalk's Business Rules Engine (BRE), I only see that you can execute the rules in .NET, but not actually create them. I have found the Microsoft.RuleEngine namespace, but the documentation is abysmal, with zero examples and I can't even tell if you can use it to create a rule, or just retrieve the rules (one example I found).
Is anyone aware of whether this API exists and/or blogs/references/docs that might be helpful.
回答1:
I think I found a partial answer at least. I found a sample using the Rule API, but I don't know yet if you can directly edit the Biztalk policies via this same library.
There is a sample in the Biztalk SDK Samples folder (C:\Program Files\Microsoft BizTalk Server 2009\SDK\Samples\Business Rules) using the Microsoft.RuleEngine to create a rule, then persist it to an XML file (using the Business Rules Language (BRL) schema).
I believe I have seen other samples showing how to import that XML file into Biztalk, so at least it looks possible as a two-step process. I'll update if I discover otherwise, for better or worse.
I'm puzzled as to why I don't see this task discussed anywhere on the interwebs. Either Biztalk is very unpopular or people just aren't using the BRE very much.
来源:https://stackoverflow.com/questions/3908582/biztalk-possible-to-create-rule-policy-programmatically