Example #1
0
        private Object2Get getObject2Get()
        {
            if (this.obj2Get == null)
            {
                this.obj2Get = new Object2Get();
            }

            return(this.obj2Get);
        }
Example #2
0
        /// <summary>
        /// 通过物理主键,从数据库中,查找记录,并根据Mapping信息,把数据封装成对象返回
        /// </summary>
        /// <param name="tableObject">含Mapping信息的对象</param>
        /// <returns>具体对象</returns>
        public T Get <T>(T tableObject) where T : new()
        {
            Object2Get obj2Get = getObject2Get();

            obj2Get.parse(tableObject);
            DataRow row = this.Get(obj2Get.AsSql(), obj2Get.GetSqlParameterNames(), obj2Get.GetSqlParameterValues());

            T result = default(T);

            if (row == null)
            {
                return(result);
            }
            else
            {
                return(DBUtil.Row2Object <T>(row));
            }
        }