码迷,mamicode.com
首页 > 其他好文 > 详细

自动生成Model层中对应表的各个字段

时间:2016-05-31 11:55:32      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:

select 
‘public ‘+
case t.name
when ‘varchar‘ then ‘string‘
when ‘smallint‘ then ‘Int16‘
when ‘int‘ then ‘Int32‘
when ‘datetime‘ then ‘DateTime‘
when ‘numeric‘ then ‘double‘
else ‘string‘ end +‘ ‘
+cl.name+‘ {get;set;}‘,
t.name,
cl.max_length,
cl.precision,
cl.scale
from sys.columns cl
left join sys.types t
on cl.user_type_id = t.user_type_id
where object_id=OBJECT_ID(‘M_user‘)
order by cl.column_id

 

自动生成Model层中对应表的各个字段

标签:

原文地址:http://www.cnblogs.com/Sunflower-/p/5545113.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!