Exemplo n.º 1
0
        public static object[] FieldsWithAttribute(ModifiableEntity entity)
        {
            TypeAttributePack pack = GetFieldsAndProperties(entity.GetType());

            if (pack == null)
            {
                return(EmptyArray);
            }

            return(pack.Fields.Select(f => f(entity)).ToArray());
        }
Exemplo n.º 2
0
        public static bool FieldContainsAttribute(Type type, PropertyInfo pi)
        {
            TypeAttributePack pack = GetFieldsAndProperties(type);

            if (pack == null)
            {
                return(false);
            }

            return(pack.PropertyNames.Contains(pi.Name));
        }
Exemplo n.º 3
0
        public static string FindPropertyName(ModifiableEntity entity, object fieldValue)
        {
            TypeAttributePack pack = GetFieldsAndProperties(entity.GetType());

            if (pack == null)
            {
                return(null);
            }

            int index = pack.Fields.IndexOf(f => f(entity) == fieldValue);

            if (index == -1)
            {
                return(null);
            }

            return(pack.PropertyNames[index]);
        }