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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 乔本生涯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)