[CSLA 3.6] Enhancement proposal: CanReadProperty/CanWriteProperty overrides missing!

[CSLA 3.6] Enhancement proposal: CanReadProperty/CanWriteProperty overrides missing!

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


stefan posted on Monday, September 08, 2008

Hi Rocky!

I am currently using Csla 3.6 in my ongoing development.
I have a mixed scenario where I in part take full advantage of  managed properties.
But I also have the need to still use the old style code in some properties.
E.g. I use GetProperty(Of T) in my getter, but I am forced to use an
If CanWriteProperty("PropertyNameStringLiteral") Then ...End If
construct in my setter part. This is because I want to avoid the call to
PropertyHasChanged. I delegate the property setting to a child object,
where PropertyHasChanged is then called explicitly.) I further rely on the ChildChanded event...

To be consistent with the 3.5-idea of reducing the string literals to a minimum,  what we need are
overrides of CanReadProperty and CanWriteProperty that take a PropertyInfo-object reference as a parameter.
Obviously the same applies to PropertyHasChanged().

I hope this makes sense to you.

[EDIT]
Forget what I wrote above. Andy just showed me the way... and it is so obvious!
Using the Name property of the PropertyInfo object is the way to go here,
even I have already done it that way. I'll have to blame it on IntelliSense...
("Hey, there are missing some parameter alternatives!")Smile [:)]
[/EDIT]

Stefan




ajj3085 replied on Monday, September 08, 2008

Can you do?

if ( CanWriteProperty( NameProperty.Name ) ) { // code here }

Where NameProperty is the static property variable.

Copyright (c) Marimer LLC