惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AI
AI
博客园 - 叶小钗
Blog — PlanetScale
Blog — PlanetScale
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
阮一峰的网络日志
阮一峰的网络日志
D
Docker
Jina AI
Jina AI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Register - Security
The Register - Security
J
Java Code Geeks
S
SegmentFault 最新的问题
月光博客
月光博客
G
Google Developers Blog
美团技术团队
Last Week in AI
Last Week in AI
L
LangChain Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
The Blog of Author Tim Ferriss
腾讯CDC
Recent Announcements
Recent Announcements
Recorded Future
Recorded Future
The Cloudflare Blog
有赞技术团队
有赞技术团队
博客园_首页
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
B
Blog
I
InfoQ
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
F
Fortinet All Blogs
B
Blog RSS Feed
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
MongoDB | Blog
MongoDB | Blog
爱范儿
爱范儿
D
DataBreaches.Net
F
Full Disclosure
M
MIT News - Artificial intelligence
博客园 - 司徒正美
H
Help Net Security

博客园 - 乔本生涯a

用来用去还是觉得SDCMS好用 Visual 2005 调试问题 收藏 图形分析报表,在VS2005 及SQL2005 Sqlserver2000 restore database 操作异常中止 水晶报表中人民币大写的转换函数 “/”应用程序中的服务器错误。 System.IO.DirectoryNotFoundException VB.Net + asp.net的一个web系统,使用SQL2000数据库 现在运行时偶尔会出现一个奇怪现象,一个用户登录时,登录后的界面竟然是另一个用户 水晶报表效果图 一个汉字转成拼音的代码 - 乔本生涯a - 博客园 自动定时备份数据 log4net 1.2.9 的配置及使用 关于动网 ASP + Access 论坛问题及相应解决办法 .Net工程中几个文件的含意 组件 访问被拒绝 --“/”应用程序中的服务器错误。IIS重启不行,系统注销也不行 Log4j进行日志操作 该页无法显示 您试图从目录中执行 CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序。 解决方法 DataGrid表头跨行合并的实现 FreeTextBox .NET平台下WEB应用程序的部署(安装数据库和自动配置)(转)
使用NHibernate进行开发 - 乔本生涯a - 博客园
乔本生涯a · 2005-08-03 · via 博客园 - 乔本生涯a

使用NHibernate开发主要有下面的几个步骤:
    ① 将NHibernate及相关的程序集引入到工程中,并对其进行配置
    ② 公用的数据层代码,如对SessionFactory等公用的操作进行封装
    ③ 创建实体层的类和相应的映射文件(可用Cool Coder等工具生成)
    ④ 生成业务层的代码框架,主要包括增、删、改、查等操作

本章关注"① 业务层的代码框架"

业务层的代码框架

一、增加
二、删除
三、修改
四、查询
五、其他
  把结果转变成DataSet
  如果想把返回的IList转变成DataSet,我们只要调一个通用的方法即可,而如果想从DataSet转变成实体类组成的IList,将会非常复杂。
  转换成DataSet的通用的方法如下:

    Private Function ConvertToDS(ByVal lst As IList, ByVal typ As System.Type) As DataSet
        Dim obj As Object
        Dim ds As New DataSet

        Dim tbl As DataTable = ds.Tables.Add(typ.Name)
        ' Get the public properties.
        Dim myPropertyInfo As System.Reflection.PropertyInfo() = typ.GetProperties((System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Instance))

        Dim pi As System.Reflection.PropertyInfo
        For Each pi In myPropertyInfo
            tbl.Columns.Add(pi.Name, System.Type.GetType(pi.PropertyType.ToString()))
        Next

        For Each obj In lst
            Dim dr As DataRow = tbl.NewRow

            For Each pi In myPropertyInfo
                dr(pi.Name) = pi.GetValue(obj, Nothing)
            Next

            tbl.Rows.Add(dr)
        Next

        Return ds
    End Function
 

  使用上面的方法来生成DataSet的方法如下:

  Dim Cust As New CustomerBR
  Dim customerLst As IList

  customerLst = Cust.GetCustomers("from Customers")

  Dim myType As System.Type = GetType(Customers)
  DataGrid1.DataSource = ConvertToDS(customerLst, myType).Tables(0)