10-19-2009 09:05 AM
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?
Solved! Go to Solution.
10-20-2009 03:15 AM
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
10-20-2009 06:49 AM
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?
10-23-2009 01:26 AM
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
10-23-2009 05:01 AM
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 !