1using System;
2using System.Data;
3using System.Data.Common;
4
5namespace Midapex.SmartOrm
6{
7 class DataReaderAdapter: DbDataAdapter
8 {
9 public int FillFromReader(DataTable dataTable, IDataReader dataReader)
10 {
11 return this.Fill(dataTable, dataReader);
12 }
13
14 //需要覆盖下面一些方法
15 protected override RowUpdatedEventArgs CreateRowUpdatedEvent(
16 DataRow dataRow,
17 IDbCommand command,
18 StatementType statementType,
19 DataTableMapping tableMapping
20 ) { return null; }
21
22 protected override RowUpdatingEventArgs CreateRowUpdatingEvent(
23 DataRow dataRow,
24 IDbCommand command,
25 StatementType statementType,
26 DataTableMapping tableMapping
27 ) { return null; }
28
29 protected override void OnRowUpdated(
30 RowUpdatedEventArgs value
31 ) { }
32 protected override void OnRowUpdating(
33 RowUpdatingEventArgs value
34 ) { }
35 }
36}
具体使用中可以实例化这个类,调用这个方法进行转化,非常简单。
主要参考翻译自:http://www.eggheadcafe.com/PrintSearchContent.asp?LINKID=628