Thanks that seems to be working, I didn't realize one could override a
property!
In case someone is looking for something similar this is how my class
structure now looks like.
generated class:
Private _description As String
<[Property]("description")> _
Public Overridable Property description() As String
Get
Return _description
End Get
Set(ByVal value As String)
value = PropertyModify("description", value)
If _description <> value Then
_description = value
PropertyHasChanged("description")
End If
End Set
End Property
inherited from generated class:
<ValidateIsUnique()> _
Overrides Property Description() As String
Get
Return MyBase.description
End Get
Set(ByVal value As String)
MyBase.description = value
End Set
End Property
I don't seem to need IsOverride since I'm not override an attribute
just adding one to a property.
~G
On Tue, Jul 21, 2009 at 6:00 PM, DaveG<[email protected]> wrote:
>
> Have a look at IsOverride on the Property attribute. This allows you
> to override an existing property and add validators to it. This may
> not be possible if your generated class doesn't mark your properties
> at virtual.
>
> Dave.
>
> On Jul 20, 1:33 pm, Gerdus van Zyl <[email protected]> wrote:
>> Is there a way to add a validator to an existing property? I have my
>> properties in a class that is generated from the database, so I can't
>> add validators there, then in a class that derives from that generated
>> class I would like to add the validators to existing properties.
>>
>> or if that is not possible how to call the validators directly(not
>> attached to property) in ValidateSelf
>>
>> thank you.
>> ~Gerdus
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---