Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Avid Listener
Posts: 17
Registered: ‎04-03-2009
Accepted Solution

Problem with Biz Rule Signature

Hi,

 

I created a simple Biz Rule on Account Enity which returns a bool.

 

public static partial class AccountBusinessRules

{

public static bool HasFaxOptOutChangedStep(IAccount account)

{

// TODO: Complete business rule implementation

 bool result = false;

IChangedState state = account as IChangedState;

if (state != null)

{

PropertyChange change = state.GetChangedState().FindPropertyChange(
"FaxOptOut");

if (change != null) result =

true;

else

result = false;

}

return result;

}

}

----------------------- When using it -------------------- 

if(account.HasFaxOptOutChanged() == true)

     ....

Signature of this biz rule shows Void, even if I defined as bool.

I get the following error: Operator '==' cannot be applied to operands of type 'void' and 'bool'

 

Any ideas how to fix this?

Silver Contributor
Posts: 1,262
Registered: ‎04-08-2009

Re: Problem with Biz Rule Signature

As far as I know the rules are always void.

What you do is:

public static void HasFaxOpen(IAccount, account, out Bool result)

 

This should work.

 

Alexander

Avid Listener
Posts: 17
Registered: ‎04-03-2009

Re: Problem with Biz Rule Signature

I tried this as well, but when invoking it, function does not takes any parameters Signature still says void HasFaxOptOut() so how do I get the out value?

 

 

Silver Contributor
Posts: 1,262
Registered: ‎04-08-2009

Re: Problem with Biz Rule Signature

So What I am doing to create a boolean rule is:

Add a business rule.

As the return type I select Boolean.

Then the method's signature changes to

public static void myrule(IAccount account, out Boolean result)

 

This is what happens in my system.

 

Does this make sense?

 

Alexander

Highlighted
Avid Listener
Posts: 17
Registered: ‎04-03-2009

Re: Problem with Biz Rule Signature

Yes. I figure ot out yesterday. I did not pick the return type Boolean, I just changed manually the signature.  Beginers mistake... I would havee if the compiler couth this.

 

Thanks !