zoukankan      html  css  js  c++  java
  • 从dataReader到Entity转化时利用Reflect示例

    Using System.Reflection
    #region    Product
            internal static Downmoon.Product.Framework.Components.Product LoadSingleProduct(IDataReader reader)
            {
                Downmoon.Product.Framework.Components.Product m_Product = new Downmoon.Product.Framework.Components.Product();
                Type type = m_Product.GetType();
                for (int i = 0; i < reader.FieldCount; i++)
                {
                    if (!reader.IsDBNull(i))
                    {
                        try { type.InvokeMember(reader.GetName(i), BindingFlags.Default | BindingFlags.SetProperty, null, m_Product, new object[] { reader.GetValue(i) }); }
                        catch (MissingMemberException exception) { System.Diagnostics.Debug.WriteLine(exception.Message); }
                    }
                }
                return m_Product;
            }
            #endregion
  • 相关阅读:
    amd
    富文本编辑器
    css module
    uc浏览器调试
    mysql利用sql语句将查询结果导出
    自启程序为何自启失败?
    nginx4层代理ssh服务
    创建SFTP用户并指定访问目录 Linux
    01月04日17:15:40 学习进度笔记
    01月04日10:39:23总结
  • 原文地址:https://www.cnblogs.com/amylis_chen/p/1966309.html
Copyright © 2011-2022 走看看