CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

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

Last post 09-08-2008, 7:19 AM by ajj3085. 1 replies.
Sort Posts: Previous Next
  •  09-08-2008, 6:02 AM 26012

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

    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




  •  09-08-2008, 7:19 AM 26015 in reply to 26012

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

    Can you do?

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

    Where NameProperty is the static property variable.
View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems