首页 > 其他 > 详细

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

时间:2016-05-31 11:53:32      阅读:240      评论: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)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!