转:http://blog.sina.com.cn/s/blog_659a572b0100xp5s.html 例子如下 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using MvcApplication2.Models; using DataAccess; using System.Configuration; using S
直接贴代码吧,有需要的话,可以根据自己的需要修改部分代码: public BigDecimal getByAttributeName(ThmdGwqriR thmdGwqriR, String attributeName){ for (Field field : thmdGwqriR.getClass().getDeclaredFields()) { field.setAccessible(true); try{ if (attributeName.toLowerCase().equals(fi
using System; using System.Collections.Generic; using System.Data; using System.Reflection; namespace Dll { public static class ToEntity { /// <summary> /// 将DataTable转换成实体类 /// </summary> /// <typeparam name="T">实体类</typepa
/// <summary> /// 将实体类存入config /// </summary> /// <param name="enity"></param> public void SetValue<T>(T enity) where T : class { System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument(); xDoc.Load(HttpContext.Cur
因为一直报实体类空异常,去网上查了资料只查到了并没有查到数据库空值时不给实体类赋值的属性 异常 org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/pojo/EmpDao.xml at org.hibernate.cfg.Configuration.addResource(Configuration.java:) at org.hibernate.cfg.Configur
工作中有这样一个需求,有N张不同的报表,每张报表对应一个数据源,统计数据采用内存方式,首先在内在里定义了数据源对应实体.统计条件用lamdba表达式式实现,通过工具对单元格进行定义.在实现过程中针对每一张表来写取数显示是很Low的了,取数条件定义都是规则的,统计实现就是一段C#代码,但是要针对不同的数据源也就是不同的List<Entity>,通过研究发现通过泛型和反射可以实现. 根据字符串获取实体类型 private Type getEntity(string typeName) { var
1: using System; 2: using System.Collections.Generic; 3: using System.Linq; 4: using System.Text; 5: using System.Data; 6: using System.Data.SqlClient; 7: using System.Reflection; 8: 9: namespace DAL 10: { 11: public class SqlHelper 12: { 13: private
此特性需要安装Kogel.Dapper.Mssql或者Oracle 3.06及以上版本,实体类层需要安装Kogel.Dapper.Extension 3.06及以上版本 目录 [LINQ2Dapper]最完整Dapper To Linq框架(一)---基础查询 [LINQ2Dapper]最完整Dapper To Linq框架(二)---动态化查询 [LINQ2Dapper]最完整Dapper To Linq框架(三)---实体类关系映射 [LINQ2Dapper]最完整Dapper To Lin