Business rule .net class

Home Page Forums BizTalk 2004 – BizTalk 2010 Business rule .net class

Viewing 1 reply thread
  • Author
    Posts
    • #14128

      Hello

      OK I have business rules working – great!
      But now I want to extend it. All my incoming data is in String format and so I cannot do any arithmetic against it. And since I have no idea about how to cast values in the rules composer I have decided to write my own .NET C# class and call it from the rules editor.

      But where and how to start?

      Any help will be appreciated. Something basic and from teh very beginning.

      Regards
      JMan

    • #14129

      Hi JMan,

      I was a little lost writing my first Business Rules .net class and implementing the IFactRetriever interface – but I found a great sample on this very site that helped me get started.

      https://www.biztalkgurus.com/Samples/BizTalk-Business-Rules-In-Code.html

      Basically you have to create your class(es) and then a fact retrievier class that implements the IFactRetriever interface so the Business Rules Engine can access the data in your class. You won’t need the interface when you move the business rules into your orchestration. I read descriptions like this many times and still didn’t understand what to do until I saw this sample. Hope this helps!

      Regards,
      Cody

      • #14130

        Well, fact retriever isn’t required. All you do is use any .NET component, make sure you’re working with public classes and methods, and then reference that assembly as a fact in the composer. Then simply call your method or set your properties. When you call that rule, you are passing in an instance of that class, and you’ll get back a potentially modified instance. I often end up with a library of random helper methods (convert string to date, etc) that are reused. The Fact Retriever comes into play when you want to cache data access (for instance, a database query) instead of incurring the database hit each time.

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.