internal bool Filter(Context context, Expression where) { foreach (PropertyInfo pi in this.GetType().GetProperties()) context.Variables[pi.Name] = pi.GetValue(this, null); return where == null || (bool)where.Calculate(context); }
private List<Hashtable> getColumnsOf(Type type, string tableName, Expression where, ListSelect fieldNames) { List<Hashtable> list = new List<Hashtable>(); foreach (PropertyInfo pi in type.GetProperties()) { if (pi.PropertyType == typeof(string) || pi.PropertyType.IsValueType || pi.PropertyType==typeof(byte[])) { if (pi.PropertyType.IsEnum) continue; Variables["COLUMN_DEFAULT"] = ""; Variables["DATA_TYPE"] = pi.PropertyType.Name; Variables["COLUMN_TYPE"] = pi.PropertyType.Name; Variables["CHARACTER_MAXIMUM_LENGTH"] = 65532; Variables["IS_NULLABLE"] = false; Variables["COLUMN_NAME"] = pi.Name; Variables["IS_AUTO_INCREMENT"] = false; Variables["TABLE_NAME"] = tableName; if (where==null || (bool)where.Calculate(this)) { Hashtable ht = new Hashtable(); foreach (Select field in fieldNames) ht[field.Alias] = field.Field.Calculate(this);//Variables[fieldName]; list.Add(ht); } } } return list; }