zoukankan      html  css  js  c++  java
  • 从dataReader到Entity转化时利用Reflect示例(解决OutOfRangeException错误)(downmoon)

    在生成代码时经常需要从DataReader转化为Entity

    比如

    Product

     当Reader只想取两三个字段(少于Entity的属性个数)时,如果不用try catch就会出错:

    OutOfRangeException
    再加上(reader["P_ID"]!=null), 也仍然出错。

     于是想到用Reflect 

    得方法如下

    Using System.Reflection 
    Product

     OK!

    邀月注:本文版权由邀月和博客园共同所有,转载请注明出处。
    助人等于自助!  3w@live.cn
  • 相关阅读:
    Oracle Redo 并行机制
    ORA16032 Can not Start Instance via srvctl but via sqlplus is fine [ID 1062071.1]
    Linux 各文件夹的作用
    Private strand flush not complete 说明
    Executing root.sh errors with "Failed To Upgrade Oracle Cluster Registry Configuration" [ID 466673.1]
    openfiler 搭建虚拟存储 并 配置服务端
    Oracle RAC CRS0184 Cannot communicate with the CRS daemon
    Redhat 5.4 RAC multipath 配置raw,运行root.sh 时报错Failed to upgrade Oracle Cluster Registry configuration 解决方法
    Openfiler + Redhat 5.4 Oracle 11gR2 RAC 安装文档
    How to Troubleshoot Grid Infrastructure Startup Issues [ID 1050908.1]
  • 原文地址:https://www.cnblogs.com/downmoon/p/1277433.html
Copyright © 2011-2022 走看看