1. SELECT
    2. CONCAT(
    3. '/// <summary>\r\n/// ',
    4. COLUMN_COMMENT,
    5. '\r\n/// </summary>\r\npublic ',
    6. CASE
    7. DATA_TYPE
    8. WHEN 'bigint' THEN
    9. 'int'
    10. WHEN 'tinyint' THEN
    11. 'int'
    12. WHEN 'varchar' THEN
    13. 'string'
    14. WHEN 'varbinary' THEN
    15. 'string'
    16. WHEN 'text' THEN
    17. 'string'
    18. WHEN 'char' THEN
    19. 'string'
    20. WHEN 'datetime' THEN
    21. 'DateTime'
    22. WHEN 'bit' THEN
    23. 'bool'
    24. WHEN 'decimal' THEN
    25. 'decimal' ELSE DATA_TYPE
    26. END,
    27. ' ',
    28. COLUMN_NAME,
    29. ' {get;set;}'
    30. ) AS Remark
    31. FROM
    32. information_schema.COLUMNS
    33. WHERE
    34. TABLE_SCHEMA = 'DB数据库名称'
    35. AND TABLE_NAME = 'Table表名'