新修改ODRM函数库1.增加SortedList对象,并且IBatisNet支持SortedList作为参数传递
2.增加动态执行方法函数。参考EvalMethod函数ODRM模式下载地址:http://www.cnblogs.com/Files/mail-ricklee/ODRM.part01.rarhttp://www.cnblogs.com/Files/mail-ricklee/ODRM.part02.rarhttp://www.cnblogs.com/Files/mail-ricklee/ODRM.part03.rar函数库说明:
ODRM using System;using System.Collections;using System.Data;using System.Reflection;namespace NickLee.Common{ // 摘要: // Object/DataSet Relational Mapping(对象/数据集关系映射) public class ODRM { public ODRM(); // 摘要: // 转换为DataTable // // 参数: // Source: // 数据源 // // DataMember: // 数据表名称 public static DataTable ConvertDataTable(object Source, string DataMember); // // 摘要: // 返回DataTable为哈希表键值对 // // 参数: // SourceRow: // 数据行对象 // // 返回结果: // 填充后哈希表 public static Hashtable DataRowConvertHashtable(DataRow SourceRow); // // 摘要: // 返回DataTable为哈希表键值对 // // 参数: // SourceRow: // 数据行对象 // // 返回结果: // 填充后哈希表 public static SortedList DataRowConvertSortedList(DataRow SourceRow); // // 摘要: // 数据集中一行DataRow转换为指定对象,并填充数据 // // 参数: // row: // 数据集中一行 // // objModel: // 指定对象 // // 返回结果: // 填充后对象 public static object DataTableConvertObject(DataRow row, object objModel); // // 摘要: // 数据集中一行DataRow转换为指定对象,并填充数据 baseAssembly请使用:System.Reflection.Assembly.LoadFrom()获取程序集 // // 参数: // row: // 数据集中一行 // // baseAssembly: // 程序集 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object DataTableConvertObject(DataRow row, Assembly baseAssembly, string className); // // 摘要: // 数据集中一行DataRow转换为指定对象,并填充数据 // // 参数: // row: // 数据集中一行 // // AssemblyPath: // 程序集路径 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object DataTableConvertObject(DataRow row, string AssemblyPath, string className); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // objModel: // 传入对象 // // methodName: // 函数名称 // // table: // 传入参数(Hashtable类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(object objModel, string methodName, Hashtable table, ref object returnobj); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // objModel: // 传入对象 // // methodName: // 函数名称 // // list: // 传入参数(SortedList类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(object objModel, string methodName, SortedList list, ref object returnobj); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // baseAssembly: // 程序集对象 // // className: // 对象名称 // // table: // 传入参数(Hashtable类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(Assembly baseAssembly, string className, string methodName, Hashtable table, ref object returnobj); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // baseAssembly: // 程序集对象 // // className: // 对象名称 // // list: // 传入参数(SortedList类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(Assembly baseAssembly, string className, string methodName, SortedList list, ref object returnobj); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // AssemblyPath: // 程序集路径 // // className: // 对象名称 // // table: // 传入参数(Hashtable类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(string AssemblyPath, string className, string methodName, Hashtable table, ref object returnobj); // // 摘要: // 执行指定对象函数(公共,静态) 函数可以ref、out、普通参数传递 // // 参数: // AssemblyPath: // 程序集路径 // // className: // 对象名称 // // list: // 传入参数(SortedList类型) // // returnobj: // 执行制定函数返回值 // // 返回结果: // 返回执行指定对象函数的传入数据(ref,out数据经过修改) public static object[] EvalMethod(string AssemblyPath, string className, string methodName, SortedList list, ref object returnobj); // // 摘要: // 哈希表对象转换为DataTable,并有一行DataRow // // 参数: // hTable: // 包含数据的哈希表 // // 返回结果: // 填充后数据表 public static DataTable HashtableConvertDataTableWidthRow(Hashtable hTable); // // 摘要: // 哈希表对象转换为DataTable,并有一行DataRow // // 参数: // hTable: // 包含数据的哈希表 // // DataMember: // 生成数据表名称 // // 返回结果: // 填充后数据表 public static DataTable HashtableConvertDataTableWidthRow(Hashtable hTable, string DataMember); // // 摘要: // 哈希表转换为对象 // // 参数: // hTable: // 包含数据的哈希表 // // objModel: // 指定对象 // // 返回结果: // 填充后对象 public static object HashtableConvertObject(Hashtable hTable, object objModel); // // 摘要: // 哈希表转换为对象 baseAssembly请使用:System.Reflection.Assembly.LoadFrom()获取程序集 // // 参数: // hTable: // 包含数据的哈希表 // // baseAssembly: // 程序集 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object HashtableConvertObject(Hashtable hTable, Assembly baseAssembly, string className); // // 摘要: // 哈希表转换为对象 // // 参数: // hTable: // 包含数据的哈希表 // // AssemblyPath: // 程序集路径 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object HashtableConvertObject(Hashtable hTable, string AssemblyPath, string className); // // 摘要: // Hashtable转化为SortedList // // 参数: // table: // 传入的Hashtable // // 返回结果: // 返回的SortedList public static SortedList HashtableConvertSortedList(Hashtable table); // // 摘要: // 哈希数据比较 作为在修改的时候或者其他时候判断是否做过处理 // // 参数: // Fristobj: // 比较哈希表 // // Equalobj: // 被比较哈希表 // // errMethod: // 返回比较不一致对象 // // 返回结果: // 比较状态 public static bool HashtableDataEqual(Hashtable Fristobj, Hashtable Equalobj, ref string errMethod); // // 摘要: // 对象转换为DataTable,并有单行DataRow // // 参数: // objModel: // 有数据的对象 // // 返回结果: // 填充后数据表 public static DataTable ObjectConvertDataTableWidthRow(object objModel); // // 摘要: // 对象转换为DataTable,并有单行DataRow // // 参数: // objModel: // 有数据的对象 // // DataMember: // 生成数据表名称 // // 返回结果: // 填充后数据表 public static DataTable ObjectConvertDataTableWidthRow(object objModel, string DataMember); // // 摘要: // 对象转换为DataTable,并有多行DataRow // // 参数: // objModel: // 有数据的对象 // // 返回结果: // 填充后数据表 public static DataTable ObjectConvertDataTableWidthRows(object[] objModel); // // 摘要: // 对象转换为DataTable,并有多行DataRow // // 参数: // objModel: // 有数据的对象 // // DataMember: // 生成数据表名称 // // 返回结果: // 填充后数据表 public static DataTable ObjectConvertDataTableWidthRows(object[] objModel, string DataMember); // // 摘要: // 对象转化为哈希表 // // 参数: // objModel: // 对象 // // 返回结果: // 填充后哈希表 public static Hashtable ObjectConvertHashtable(object objModel); // // 摘要: // 对象转化为哈希表 // // 参数: // objModel: // 对象 // // 返回结果: // 填充后哈希表 public static SortedList ObjectConvertSortedList(object objModel); // // 摘要: // 对象数据比较 作为在修改的时候或者其他时候判断是否做过处理 // // 参数: // Fristobj: // 比较对象 // // Equalobj: // 被比较对象 // // errMethod: // 返回比较不一致对象或者类不一致提示 // // 返回结果: // 比较状态(false不一致,true一致) public static bool ObjectDataEqual(object Fristobj, object Equalobj, ref string errMethod); // // 摘要: // SortedList对象转换为DataTable,并有一行DataRow // // 参数: // hTable: // 包含数据的SortedList // // 返回结果: // 填充后数据表 public static DataTable SortedListConvertDataTableWidthRow(SortedList hTable); // // 摘要: // SortedList对象转换为DataTable,并有一行DataRow // // 参数: // hTable: // 包含数据的SortedList // // DataMember: // 生成数据表名称 // // 返回结果: // 填充后数据表 public static DataTable SortedListConvertDataTableWidthRow(SortedList hTable, string DataMember); // // 摘要: // SortedList转化为Hashtable // // 参数: // list: // 传入的SortedList // // 返回结果: // 返回的Hashtable public static Hashtable SortedListConvertHashtable(SortedList list); // // 摘要: // SortedList转换为对象 // // 参数: // hTable: // 包含数据的SortedList // // objModel: // 指定对象 // // 返回结果: // 填充后对象 public static object SortedListConvertObject(SortedList hTable, object objModel); // // 摘要: // SortedList转换为对象 baseAssembly请使用:System.Reflection.Assembly.LoadFrom()获取程序集 // // 参数: // hTable: // 包含数据的SortedList // // baseAssembly: // 程序集 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object SortedListConvertObject(SortedList hTable, Assembly baseAssembly, string className); // // 摘要: // SortedList转换为对象 // // 参数: // hTable: // 包含数据的SortedList // // AssemblyPath: // 程序集路径 // // className: // 完整路径类名称 // // 返回结果: // 填充后对象 public static object SortedListConvertObject(SortedList hTable, string AssemblyPath, string className); // // 摘要: // SortedList数据比较 作为在修改的时候或者其他时候判断是否做过处理 // // 参数: // Fristobj: // 比较SortedList // // Equalobj: // 被比较SortedList // // errMethod: // 返回比较不一致对象 // // 返回结果: // 比较状态 public static bool SortedListDataEqual(SortedList Fristobj, SortedList Equalobj, ref string errMethod); }}