简体   繁体   中英

What are the usages of FactRetriever?

As I'm getting familiar to FactRetriever , one of it's usages introduced as a way to test policies in the Business Rule Composer .

What are the other ways to use it.

I've found this link: http://msdn.microsoft.com/en-us/library/aa560118.aspx and there's some code seems to introduce a new way. A piece of that code is:

RuleEngineComponentConfiguration fr = new RuleEngineComponentConfiguration("MyAssembly", "Retriever");
RuleSet rs = new RuleSet("ruleset");
// associate the execution configuration with a ruleset
RuleSetExecutionConfiguration rsCfg = rs.ExecutionConfiguration;
rsCfg.FactRetriever = factRetriever;

Although it seems doing what I want. But I don't understand how does it work. I'm not familiar with the concepts like RuleEngineComponentConfiguration , RuleSet or RuleSetExecutionConfiguration . Also I didn't found any good documentation about the whole code samples came in the link.

Question 1: Is it possible to define it somewhere in BizTalk Server itself to use them (Not in the Business Rule Composer)?

Question 2: Is there any good documentation abut the object model of Microsoft.RuleEngine and its key concepts?

The BRE has, or you could say is, a full .Net API so that code snippet simple demonstrates how to specify a Fact Retriever for a Policy programmatically vs config (meaning the policy Xml, not a .config or anything like that). This is the exact same thing the actual engine would do if you specify a Fact Retriever.

Q1: No, not when using the Call Rules Shape, the entire Policy must be configured, including the Fact Retriever, in the Composer. Technically, you can execute the Policy from a helper class in an Expression Shape where you have full access to the API.

Q2: Sorry no, other than the basics at MSDN. The classes are well named though. Except for curiosity, it's not something you probably have to worry about. I frequently see Policies executed in C# but I've never seen anyone actually build the Policy and Rules in C#.

This is the part of the API everyone uses for the BRE: http://msdn.microsoft.com/en-us/library/aa561833.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM