摘要:
/// /// /// /// 要转换的值 /// 要转换成的类型 /// private static object ChangeType(object value, Type conversionType) { if (conversionType.IsGenericType && conversionType.GetGenericTypeDefinition().Equals(typeof(Nullable))) { ... 阅读全文
摘要:
生成SqlParameter[] public class DbParameterGenerator { /// /// 根据方法的参数获取sqlparameter /// /// 方法对像 /// 参数对应的值 /// public static System.Data.SqlClient.SqlParameter[] GetParameterGenerator(System.Reflection.MethodInfo method, object[] values) ... 阅读全文
摘要:
对于特性与反射的一些基本知识可以参考MSDN:http://msdn.microsoft.com/zh-cn/library/vstudio/ms173183.aspx下面利用反射与特性做了一个关于实现DataTable与实体之间的相互转化的Demo.实体类 Author: public partial class Author { public Author() { } #region Model private int _id; private string _title; private strin... 阅读全文