예제 #1
0
        public override T Retrieve <T>(BaseEntity entity)
        {
            var lstResult = dao.ExecuteQueryProcedure(_mapper.GetRetriveStatement(entity));
            var dic       = new Dictionary <string, object>();

            if (lstResult.Count > 0)
            {
                dic = lstResult[0];
                var objs = _mapper.BuildObject(dic);
                return((T)Convert.ChangeType(objs, typeof(T)));
            }

            return(default(T));
        }
예제 #2
0
        public override T Retrieve <T>(string id)
        {
            try
            {
                var lstResult = SqlDao.ExecuteQueryProcedure(_mapper.GetRetriveByIdStatement(id));
                var dic       = new Dictionary <string, object>();

                if (lstResult.Count > 0)
                {
                    dic = lstResult[0];
                    var objs = _mapper.BuildObject(dic);
                    return((T)Convert.ChangeType(objs, typeof(T)));
                }

                return(default(T));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }