示例#1
0
        private T ReadEntityProperty <T>(IDataReader reader, EntityPropertySetFunc <T> setFunc) where T : new()
        {
            T   entity  = new T();
            var columns = _schema.GetColumns();

            foreach (var column in columns)
            {
                try
                {
                    object fieldValue = reader[column.Name];
                    if (setFunc != null)
                    {
                        setFunc(entity, column, fieldValue);
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(string.Format("read {0} table's {1} column error.", _schema.EntityName, column.Name), ex);
                }
            }
            return(entity);
        }