//通过匿名对象生成实体类 var dynamicObj = new { id = 1, name = "小名", entity = new enityt1() }; //注意:只能是单个实体不能传入 List<T> ,集合需要 List[0] string classCode = ClassGenerating.DynamicToClass(dynamicObj, "classDynamic"); //通过datatable生成实体类 DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(int)); dt.Columns.Add("Name"); classCode = ClassGenerating.DataTableToClass(dt, "classTatabale"); //通过sql语句生成实体类 classCode = ClassGenerating.SqlToClass("select * from note", "Note", "127.0.0.1", "MyWork", "sa", "sasa"); classCode = ClassGenerating.SqlToClass("select * from dbo.AccessoriesDetail", "AccessoriesDetail", "NFDEntities");//通过 config connstring名称
然后在调试状态把你需要的结果CTRL+C 然后去新建一个类CTRL+V
您可能感兴趣的文章: