Beispiel #1
0
        /// <summary>
        /// 根据Reader的内容把数值赋进实体
        /// </summary>
        /// <param name="reader">Reader</param>
        /// <param name="index">当前Reader的索引</param>
        /// <param name="arg">目标对象</param>
        /// <param name="info">目标属性的句柄</param>
        public static void ValueFromReader(IDataReader reader, int index, object arg, EntityPropertyInfo info, bool needChangeType)
        {
            object val = reader.GetValue(index);

            if (needChangeType)
            {
                Type resType = info.RealFieldType;//字段值类型
                val = CommonMethods.ChangeType(val, resType);
            }
            info.SetValue(arg, val);
        }