Example #1
0
 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));
 }
Example #2
0
 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());
 }
Example #3
0
 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());
 }
Example #4
0
 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());
 }