SELECT
CONCAT(
'/// <summary>\r\n/// ',
COLUMN_COMMENT,
'\r\n/// </summary>\r\npublic ',
CASE
DATA_TYPE
WHEN 'bigint' THEN
'int'
WHEN 'tinyint' THEN
'int'
WHEN 'varchar' THEN
'string'
WHEN 'varbinary' THEN
'string'
WHEN 'text' THEN
'string'
WHEN 'char' THEN
'string'
WHEN 'datetime' THEN
'DateTime'
WHEN 'bit' THEN
'bool'
WHEN 'decimal' THEN
'decimal' ELSE DATA_TYPE
END,
' ',
COLUMN_NAME,
' {get;set;}'
) AS Remark
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = 'DB数据库名称'
AND TABLE_NAME = 'Table表名'