/// <summary> /// Resolves property handler type from property attributes /// </summary> /// <param name="aObject"> /// Object property belongs to <see cref="System.Object"/> /// </param> /// <param name="aProp"> /// Property info <see cref="PropertyInfo"/> /// </param> /// <returns> /// Property handler type <see cref="PropertyHandlerType"/> /// </returns> public static PropertyHandlerType GetPropertyHandlerType(object aObject, PropertyInfo aProp) { PropertyDescriptionAttribute attr = GetPropertyDescription(aObject, aProp); if (attr == null) { return(PropertyHandlerType.Default); } return(attr.HandlerType); }
/// <summary> /// Resolves property handler from property attributes /// </summary> /// <param name="aObject"> /// Object property belongs to <see cref="System.Object"/> /// </param> /// <param name="aProp"> /// Property info <see cref="PropertyInfo"/> /// </param> /// <returns> /// Property handler name <see cref="System.String"/> /// </returns> public static string GetPropertyHandler(object aObject, PropertyInfo aProp) { PropertyDescriptionAttribute attr = GetPropertyDescription(aObject, aProp); if (attr == null) { return(""); } return(attr.DataTypeHandler); }
/// <summary> /// Resolves property field name from property attributes /// </summary> /// <param name="aObject"> /// Object property belongs to <see cref="System.Object"/> /// </param> /// <param name="aProp"> /// Property info <see cref="PropertyInfo"/> /// </param> /// <returns> /// Field name <see cref="System.String"/> /// </returns> public static string GetPropertyFieldName(object aObject, PropertyInfo aProp) { PropertyDescriptionAttribute attr = GetPropertyDescription(aObject, aProp); if (attr == null) { return(""); } return(attr.FieldName); }
/// <summary> /// Resolves property title from property attributes /// </summary> /// <param name="aType"> /// Type property belongs to <see cref="System.Type"/> /// </param> /// <param name="aPropertyName"> /// Property name <see cref="System.String"/> /// </param> /// <returns> /// Title string <see cref="System.String"/> /// </returns> public static string GetPropertyTitle(System.Type aType, string aPropertyName) { PropertyDescriptionAttribute attr = GetPropertyDescription(aType, aPropertyName); if (attr == null) { return(""); } return(attr.Title); }
/// <summary> /// Gets description for referenced Target /// </summary> public PropertyDescriptionAttribute GetDescription() { PropertyDescriptionAttribute val = null; if (Resolve() == true) { val = dataCache.GetDescription(Adaptor.FinalTarget); } return(val); }
/// <summary> /// Resolves property info, description and range /// </summary> private void Resolve() { if ((DataSourceType != null) && (PropertyName != "")) { if (TypeValidator.IsCompatible(DataSourceType, typeof(DataRow)) == true) { throw new NotSupportedException("DataRow is not supported"); } if (TypeValidator.IsCompatible(DataSourceType, typeof(IVirtualObject)) == true) { throw new NotSupportedException("IVirtualObject is not supported"); } propertyInfo = DataSourceType.GetProperty(PropertyName); if (State == PropertyDefinition.ReadWrite) { if (propertyInfo != null) { if (propertyInfo.CanWrite == false) { State = PropertyDefinition.ReadOnly; } } } if (propertyInfo != null) { description = propertyInfo.GetPropertyDescription(); range = propertyInfo.GetPropertyRange(); } else { description = null; range = null; } return; } propertyInfo = null; description = null; range = null; }