注意:尽量使用 GetEntityInfoNoCache不要用 GetEntityInfo(NoCache是副本和ORM使用不会共享)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var entityInfo= db.EntityMaintenance.GetEntityInfoNoCache( typeof (Order)); Console.WriteLine(entityInfo.DbTableName); //输出表名 foreach ( var column in entityInfo.Columns) { Console.WriteLine(column.ColumnDescription); //输出列的信息 column.xxx } [SugarTable( "dbo.STudent" )] public class Student { [SugarColumn(IsPrimaryKey= true ,IsIdentity= true ,ColumnName= "StudentID" ,ColumnDescription = "主键" )] public int Id { get ; set ; } public string Name { get ; set ; } } |
方法名 | 描述 | 返回类型 |
---|---|---|
GetEntityInfo | 获取实体信息 | EntityInfo |
GetTableName | 从实体获取表名 | string |
GetEntityName | 获取实体名 | string |
GetDbColumnName | 获取数据库列名 | string |
GetProperty | 获取属性 | PropertyInfo |
2016 © donet5.comApache Licence 2.0