|
Home > Archive > BizTalk Server General > March 2004 > Rules Engine - .Net class based fact instantiation
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Rules Engine - .Net class based fact instantiation
|
|
| Gareth Jane 2004-03-20, 9:23 pm |
| If I create a policy in Rules Engine which uses facts based on a .Net
class it would appear that this object first needs to be instantiated
in code. While this is manageable when calling a policy from code, it
creates a problem when calling a policy from BizTalk using the Rules
Shape.
If I call a policy from BT which references a .Net class how can we
pre-instantiate this referenced class? It seems totally bizarre to me
that the Rules Engine does not automatially create instances of
objects as required??
Are we missing something here?
Is this where we should be using the fact retriever?
Thanks
G.
| |
| Frank Wilson 2004-03-20, 9:23 pm |
| In your orchestration, create a variable (in the Orchestration View) of the
type of you .NET class to be used with the rules engine. Add an Expression
shape before your Call Rules shape and create an instance of your class and
assign it to the variable. In the Call Rules shape, select your variable as
a parameter.
That should do it. The object instance is created by the orchestration
prior to calling the rule and passed in. You need to do this even if you're
just calling static methods on the class.
hth,
Frank
"Gareth Jane" <gareth@ke.co.za> wrote in message
news:606b53f4.0403190307.73c51954@posting.google.com...
> If I create a policy in Rules Engine which uses facts based on a .Net
> class it would appear that this object first needs to be instantiated
> in code. While this is manageable when calling a policy from code, it
> creates a problem when calling a policy from BizTalk using the Rules
> Shape.
>
> If I call a policy from BT which references a .Net class how can we
> pre-instantiate this referenced class? It seems totally bizarre to me
> that the Rules Engine does not automatially create instances of
> objects as required??
>
> Are we missing something here?
>
> Is this where we should be using the fact retriever?
>
> Thanks
>
> G.
| |
| Gareth Jane 2004-03-24, 10:44 am |
| Thanks Frank
Just the tip I needed - it works!
Of course this means one has to be really careful when designing
policies as the buiness rules are not fully abstracted from the
implementation. The ideal is that business users can change the
policies to their hearts content without requiring changes to the
calling orchestration or code. If we re-version classes called by
policies, however, we will also need to change the orchestrations...
G.
"Frank Wilson" <nospam@hotmail.com> wrote in message news:<#E8AQYeDEHA.2576@TK2MSFTNGP11.phx.gbl>...
> In your orchestration, create a variable (in the Orchestration View) of the
> type of you .NET class to be used with the rules engine. Add an Expression
> shape before your Call Rules shape and create an instance of your class and
> assign it to the variable. In the Call Rules shape, select your variable as
> a parameter.
>
> That should do it. The object instance is created by the orchestration
> prior to calling the rule and passed in. You need to do this even if you're
> just calling static methods on the class.
>
> hth,
> Frank
>
|
|
|
|
|