private Object2Find getObject2Find() { if (this.obj2Find == null) { this.obj2Find = new Object2Find(); } return(this.obj2Find); }
/// <summary> /// 通过逻辑主键,从数据库中,查找记录,并根据Mapping信息,把数据封装成对象返回 /// </summary> /// <param name="tableObject">含Mapping信息的对象</param> /// <returns>具体对象</returns> public T Find <T>(T tableObject) where T : new() { Object2Find Obj2Find = getObject2Find(); obj2Find.parse(tableObject); DataRow row = this.Find(Obj2Find.AsSql(), Obj2Find.GetSqlParameterNames(), Obj2Find.GetSqlParameterValues()); T result = default(T); if (row == null) { return(result); } else { return(DBUtil.Row2Object <T>(row)); } }