IF数据查询,使用查询类构建查询条件,拼接SQL语句。
要对用户表进行查询操作,先构建查询类:
[Serializable] public class SysUserCriteria : IfCriteria<SysUserCriteria> { [DisplayName("姓名")] [CriteriaField(ColumnName = @"SUR_NAME", FriendlyName = @"姓名", Logical = CriteriaLogical.And, Operate = CriteriaOperate.Like)] public string Name { get; set; } }
查询数据方法:
var Criteria = new SysUserCriteria(); Criteria.Name = this.textBox1.Text.Trim(); SysUserList selDataList = SysUserList.Fetch(Criteria);
通过调用Fetch方法,即可查询出数据对象列表。