Winform制作的POCO自动生成工具V1.0绿色免安装版

由于有同学表示不明白POCO啥意思,所以这里就稍微普及下POCO是啥。POCO是 Plain Old CLR Object的缩写,类似Java的POJO (Plain Old Java Object)。它是一个轻量级的类,在Java中POJO一般是一个Java Bean。具体解释看下面,相信大家都已经用过:

什么是POCO呢?http://en.wikipedia.org/wiki/Plain_Old_CLR_Object(简单传统CLR对象)

POCO is an acronym for Plain Old CLR Object. It is a play on the term POJO, from the Java EE programming world, and is used by developers targeting the Common Language Runtime of the .NET Framework.Similar to the Java context, the term is used to contrast an object with one that is designed to be used with a complicated, special object frameworks such as an ORM component.In .NET terms, the word is most often used in the programmatic sense, to differentiate a non Serviced Component (see MTS) from a "standard object". It can also be used in a tongue in cheek manner, referencing the perceived complexity of Java based programming frameworks such as EJB. 注意上面英文粗体部分,即POCO常常在ORM框架中使用,比如常在EF中使用,下面的代码: var order = myDataContainer.Orders.FirstOrDefault(c => c.id == 1); Orders是Order类的对象的集合,Order类即一个POCO。

基于之前分享的代码 生成POCO的小工具 ,今天用Winform拖控件方式做了个界面。界面缺乏美感,大家轻拍! 虽然EF的Model First方式支持自动生成POCO,但实际开发中Model First方式采用并不多,大多还是Code First方式,所以免不了写POCO,而如果表的字段很多的话,无疑会费力又容易出错,比如拼错(尤其是数据库表中字段拼写不规范,而你本人又对拼写却很严谨时,你懂的)。 使用方法: 设置好数据库连接信息后,点 ”生成POCO“ 按钮,然后点 ”打开文件夹“ 就可以转到生成的POCO文件所在目录。 支持的功能: 1、支持保存数据库连接信息,下次打开就默认加载保存的数据库连接信息(点 ”保存当前配置信息“ 按钮) 2、支持勾选是否带Summary、Description、DisplayName和Column等属性 <无> .CodeEntity .code_pieces ul.piece_anchor{width:25px;position:absolute;top:25px;left:-30px;z-index:1000;}.CodeEntity .code_pieces ul.piece_anchor li{width:25px;background: #efe;margin-bottom:2px;}.CodeEntity .code_pieces ul.piece_anchor li{border-left:3px #40AA63 solid;border-right:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li:hover{border-right:3px #40AA63 solid;border-left:3px #efe solid;}.CodeEntity .code_pieces ul.piece_anchor li a{color: #333;padding: 3px 10px;}.CodeEntity .code_pieces .jump_to_code{visibility:hidden;position:relative;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code{visibility:visible;}.CodeEntity .code_pieces .code_piece:hover .jump_to_code a{text-decoration:none;}.CodeEntity .code_pieces h2 i{float:right;font-style:normal;font-weight:normal;}.CodeEntity .code_pieces h2 i a{font-size:9pt;background: #FFFFFF;color:#00A;padding: 2px 5px;text-decoration:none;}

Winform制作的POCO自动生成工具V1.0绿色免安装版

相关文章:

你感兴趣的文章:

标签云: