Hi Rocky,
Have you considered inheriting Csla.PropertyInfo<T> from System.ComponentModel.PropertyDescriptor class? You can get a list of properties for a specific class by TypeDescriptor.GetProperties(typeof(ClassName)) and PropertyDescriptor will have a lot of useful properties populated, such as `Converter` (TypeConverter for this property), `IsReadOnly`, `DisplayName`, `Name`, `Description`. (It takes some information from property's attributes like, DescriptionAttribute, DisplayNameAttribute and ReadOnlyAttribute.)
Also currently you use "" as a default friendlyName but I think the most appropriate is to use the one from DisplayName property.
Thanks
Not sure that's a good idea, because it uses reflection... which I believe was what PropertyInfo<T> was meant to avoid.
Well, PropertyDescriptor by itself is an abstract class and it is not mandatory to use a reflection in order to get a valid instance of PropertyDescriptor. But the one obtained via reflection is widely used by the .NET framework. (when displaying column names in the DataGridView using DisplayName, using ReadOnly or using TypeConverter for interpreting string data to another type.)
PropertyDescriptor doesn't exist in Silverlight, so it isn't useful in the general case.
Also currently you use "" as a default friendlyName but I think the most appropriate is to use the one from DisplayName property.
There is an item in the wish list to pull the friendly name from the DisplayName attribute when RegisterProperty() is invoked. That got a little more complicated now with DataAnnotations though, since I think they defined yet another friendly name attribute to check for...
The upside is that the new attribute in DataAnnotations supports localization, which was one reason the older DisplayName attribute wasn't ideal.
I haven't noticed DataAnnotations' DisplayAttribute... Looks like it is indeed a better way for specifying friendly name. Perhaps when RegisterProperty is called it should look for DisplayAttribute and fall back to DisplayNameAttribute if wasn't found?
This is almost certainly what we'll do, yes.
Copyright (c) Marimer LLC