public static bool HasDataProviderField(object obj, string fieldName) { return(obj.GetType() .GetProperties() .Where(p => DataProviderResultField.IsDefined(p, typeof(DataProviderResultField))) .Any(p => ((DataProviderResultField)DataProviderResultField.GetCustomAttribute(p, typeof(DataProviderResultField))).Field == fieldName)); }
public static PropertyInfo GetDataProviderField(object obj, DataProviderKeyType keyType) { return(obj.GetType() .GetProperties() .Where(p => DataProviderResultField.IsDefined(p, typeof(DataProviderResultField))) .Where(p => ((DataProviderResultField)DataProviderResultField.GetCustomAttribute(p, typeof(DataProviderResultField))).KeyType == keyType).FirstOrDefault()); }
public static List <PropertyInfo> GetDataProviderResultFieldActionList(object obj, DataProviderResultFieldAction fieldAction) { return(obj.GetType() .GetProperties() .Where(p => DataProviderResultField.IsDefined(p, typeof(DataProviderResultField))) .Where(p => ((DataProviderResultField)DataProviderResultField.GetCustomAttribute( p, typeof(DataProviderResultField))).Actions.Contains(fieldAction)).ToList()); }
public static PropertyInfo GetDataProviderResultFieldActionSingle(object obj, DataProviderResultFieldAction fieldAction) { return(obj.GetType() .GetProperties() .Where(p => DataProviderResultField.IsDefined(p, typeof(DataProviderResultField))) .Where(p => ((DataProviderResultField)DataProviderResultField.GetCustomAttribute( p, typeof(DataProviderResultField))).Actions.Contains(fieldAction)).FirstOrDefault()); }