简体   繁体   中英

Is it possible to specify when to execute a FactRetriever?

In the following documentation there's some information to create FactRetriever s. http://msdn.microsoft.com/en-us/library/aa560118.aspx

But it didn't mention how often will they execute.

Question 1: What is the mechanism to determine the interval of executing a FactRetriever ?

Question 2: Is it possible to subscribe the execution of a FactRetriever to an event? For example to a Database Trigger or on Creation of a file in a specified folder ?

No, not explicitly.

That article does state that UpdateFacts, the only method defined in IFactRetriever, will be called every time the Policy is executed.

So, to answer you specific questions:

  1. UpdateFacts is called every time the Policy is executed.
  2. Technically yes, but it would be your own implementation. The instance of your IFactRetreiver is cached in memory so you're certainly free to hook into any event you want. So, if you hear you db trigger fire, you make a note to update the Facts the next time the Policy is executed. You could also keep a timer or any thing else you write or is available in .Net.

To note, since it's not clear in the article, factsHandleIn is a reference to the collection of facts you originally used with engine.Assert(). This is usually an object[].

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