1 USE INFORMATION_SCHEMA; 2 SELECT 3 CONCAT( 4 '/// <summary>\r\n/// ', 5 COLUMN_COMMENT, 6 '\r\n/// </summary>\r\n[DataMember]\r\npublic ', 7 CASE 8 DATA_TYPE 9 WHEN 'bigint' THEN 10 'int' 11 WHEN 'tinyint' THEN 12 'int' 13 WHEN 'varchar' THEN 14 'string' 15 WHEN 'varbinary' THEN 16 'string' 17 WHEN 'text' THEN 18 'string' 19 WHEN 'char' THEN 20 'string' 21 WHEN 'datetime' THEN 22 'DateTime' 23 WHEN 'bit' THEN 24 'bool' 25 WHEN 'decimal' THEN 26 'decimal' ELSE DATA_TYPE 27 END, 28 ' ', 29 COLUMN_NAME, 30 ' {get;set;}\r\n' 31 ) 32 FROM 33 COLUMNS 34 WHERE 35 TABLE_SCHEMA = 'Your DB Name' 36 AND TABLE_NAME = 'Your Table Name';
标签:实体模型,string,C#,WHEN,int,MySQL,DATA From: https://www.cnblogs.com/WinHEC/p/MySQL_To_CSharp_Model.html