Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Data type conversion in Business rule

$
0
0

Hi,

I have a business rule, Where i need to assign a value to the property. However, the tricky part is the casting the value to the type of property.

For example:

in business rule call:        BusinessRules.AddRule(New AssignValueRule(NameProperty))

                                              BusinessRules.AddRule(New AssignValueRule(AgeProperty))

Here, name is string and Age is integer. So when i assign value in the busines rule "AssignValueRule", i need to cast it to the property type, its something like below.

                     Context.AddOutValue(PrimaryProperty, Cast(inputValue, TypeOf(PrimaryProperty))

when rule called on "NameProperty" the inputValue should be casting to String. And when called on "AgeProperty", inputValue should be casting to Integer.

Please help me in implementing this.

 

Thanks in advance.

Arjun.

 


Viewing all articles
Browse latest Browse all 764

Trending Articles