My team is in the process of implementing a claims-based authorization setup. This means that we are calling CanReadProperty and CanWriteProperty a great deal. The standard CSLA (Beta 3 of CSLA 4) offers two choices to identity the property: a string containing the name of the property and the property info object. We do not want to use strings (for all sorts of reasons including typos and the lack of refactoring) and we would prefer to not expose the property info fields. We would like to see CanXXXProperty methods that take an expression, similar to the functionality for registering the property in the first place.
I hope that this is not too late to get into the final CSLA 4.
You should expose the PropertyInfo<T> fields as public.
This is a recommended best practice for CSLA 4, and is basically required for any SL4 work.
But it also matches the normal declaration and usage of dependency properties, on which CSLA properties are modeled. The whole point of having the metadescriptors (the PropertyInfo<T> fields) is to allow the application to make use of that metadata without resorting to reflection.
Accepting an expression would require a reflection call every time, which is just not elegant, and will have a perf impact if it is used frequently - and you indicate that it would be used frequently.
But ultimately, the recommended practice in CSLA 4 is to make the PropertyInfo<T> fields public.
Thanks. A version of the application in SL4 is not planned at this time but is a distinct possibility. Public, it is.
Copyright (c) Marimer LLC