Mysql生成C#实体类
select CONCAT('[Display(Name = "',COLUMN_COMMENT,'")]\r\n',case when CHARACTER_MAXIMUM_LENGTH !=''then concat( '[StringLength(',CHARACTER_MAXIMUM_LENGTH,', ErrorMessage = "{0}长度不能超过{1}")]\r\n') else '' end,'public ', case DATA_TYPE when 'varchar' then 'string' when 'text' then 'string' when 'int' then 'int?' when 'date' then 'DateTime?' when 'decimal' then 'Decimal?' else '' end,' ',COLUMN_NAME,' { get; set; }\r\n' ) field
from information_schema.columns where table_schema='SewerageUser' and TABLE_NAME='SewerageUser'
生成如下实体