Invoke/Call specific validation rule from ValidationRules

Invoke/Call specific validation rule from ValidationRules

Old forum URL: forums.lhotka.net/forums/t/5009.aspx


ixman posted on Monday, June 23, 2008

Hi,

Is there any possibility to call a specific validation rule defined for a property? I have more rules associated, but at some point I need to call just one from the collection.

Thanks,

George

sergeyb replied on Monday, June 23, 2008

Not as far as I know.  You can though call all rules for a specific property - ValidtionRules.CheckRules(“SomeProperty”).

 

 

Sergey Barskiy

Senior Consultant

office: 678.405.0687 | mobile: 404.388.1899

Magenic ®

Microsoft Worldwide Partner of the Year | Custom Development Solutions, Technical Innovation

 

From: ixman [mailto:cslanet@lhotka.net]
Sent: Monday, June 23, 2008 2:58 PM
To: Sergey Barskiy
Subject: [CSLA .NET] Invoke/Call specific validation rule from ValidationRules

 

Hi,

Is there any possibility to call a specific validation rule defined for a property? I have more rules associated, but at some point I need to call just one from the collection.

Thanks,

George



ixman replied on Monday, June 23, 2008

Hi,

Thanks for the quick feedback... Yes, I knew that... I just wanted to know if there is an "official" way to call a specific rule on a property...or a workaround...

Thanks,

George

RockfordLhotka replied on Monday, June 23, 2008

There is no way to do specifically what you ask.

But using priorities and short-circuiting techniques you could (in theory) come up with a scheme by which that rule runs first, and in the scenario where it should be the only one to run it would prevent any subsequent rules from running.

ixman replied on Tuesday, June 24, 2008

Thanks Rocky,

I'll go this path... using the priorities and short-circuiting algorithm...

George

Copyright (c) Marimer LLC