/// <summary>
        /// Resolve the associated attribute given an expression which should reference to the attribute.
        /// </summary>
        /// <typeparam name="TControl"></typeparam>
        /// <typeparam name="TType"></typeparam>
        /// <param name="expression"></param>
        /// <param name="equalityComparer"></param>
        /// <returns></returns>
        public static Attribute <TType> ResolveFor <TControl, TType>(Expression <Func <TControl, TType> > expression, IEqualityComparer <TType> equalityComparer = default)
        {
            var propertyExpression = ExpressionChainExtractor.Default.Decode(expression.Body).ToArray();

            var attribute = Components.Attribute.Register(AttributeReflectionHelper <TControl> .FullName((propertyExpression[0] as PropertyMemberDetails).PropertyInfo), equalityComparer: equalityComparer);

            return(attribute);
        }
Esempio n. 2
0
 static AttributeReflectionHelper()
 {
     Instance = new AttributeReflectionHelper <T>();
 }