在开发中可能会遇到这几种情况 1.EF或LINQ查询出来的匿名对象在其它地方调用不方便,又懒的手动建实体类 2.通过datatable反射实体需要先建一个类 ,头痛 3.通过SQL语句返回的实体也需要先建一个类 ,头痛 4.如果通过代码生成器要写模版,需要安装或者不想生成一堆不用的类 为了解决上面的不便之处,我封装了一个实体生成类,可以扔到程序里面任意调用 封装类: using System; using System.Collections.Generic; using System.Linq
代码如下: 实体类: public class User implements Serializable { private static final long serialVersionUID = 1L; private String pkid; private String userName; private String passWord; private String roleID; } 遍历: public class test { public static void main(St
实体类基类: using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Common { /// <summary> /// 实体类基类 /// </summary> [Serializable] public abstract class
System类 访问系统属性 - 遍历 package org.zln.usefulclass.system; import java.util.Properties; /** * Created by sherry on 000024/6/24 23:08. */ public class TestSystemProperty { public static void main(String[] args) { //showSystemProperties(); /*获取某个系统属性*/ Sy
Java利用hibernate进行一对多查询时,把另一张表作为一个属性存进这张表的字段中,返回的类型是set类型,要对返回的set类型进行排序 user表 package onlyfun.caterpillar; public class User { private Long id; private String name; public User() {} public Long getId() { return id; } public void setId(Long id) { this