(PUB_C_DEPARTMENT);

 var a = from property in t.GetProperties()
                        from ColumnAttribute attribute 
in property.GetCustomAttributes(typeof(ColumnAttribute), false)
                         
where attribute.IsPrimaryKey == true
                        select 
new { property = property, column = attribute }

                          var s 
= a.Select(p => p.property.NameFirst();

 

linq 利用反射 获取主键

相关文章: