コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        /// <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);
        }
コード例 #5
0
        /// <summary>
        /// Gets description for referenced Target
        /// </summary>
        public PropertyDescriptionAttribute GetDescription()
        {
            PropertyDescriptionAttribute val = null;

            if (Resolve() == true)
            {
                val = dataCache.GetDescription(Adaptor.FinalTarget);
            }
            return(val);
        }
コード例 #6
0
 /// <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;
 }