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 Remarkss
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = 'feixmanagedb'
AND TABLE_NAME = 'systemversioninfo';
==============================================================================================================================================
SELECT
CONCAT(
'[Column("',
COLUMN_NAME,
'")]\r\n[DisplayName("',
COLUMN_COMMENT,
'")]\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 Remarkss
FROM
information_schema.COLUMNS
WHERE
TABLE_SCHEMA = 'fxmaintaindb'
AND TABLE_NAME = 'relation_urchase_sales';
标签:实体类,NAME,C#,WHEN,COLUMN,int,MySql,DATA,string From: https://www.cnblogs.com/wa502/p/17695376.html