public static object[] FieldsWithAttribute(ModifiableEntity entity) { TypeAttributePack pack = GetFieldsAndProperties(entity.GetType()); if (pack == null) { return(EmptyArray); } return(pack.Fields.Select(f => f(entity)).ToArray()); }
public static bool FieldContainsAttribute(Type type, PropertyInfo pi) { TypeAttributePack pack = GetFieldsAndProperties(type); if (pack == null) { return(false); } return(pack.PropertyNames.Contains(pi.Name)); }
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]); }