普通 T4 DAL 模板和 poco 生成
我正在寻找 T4 模板来为数据库表生成完全普通的 poco 和 dal 类。
poco 应该为表的每一列都有一个 get、set 。不需要的列应该用可以为 null 的类型表示
dal get 方法应该使用 datareader 返回 IEnumerable
I'm looking for T4 templates to generate completely vanilla poco and dal classes for a database table.
the poco should have a get, set for each column of the table. columns which aren't required should be represented with nullable types
The dal get method should use a datareader to return an IEnumerable
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该视频演示了与您正在寻找的方法类似的方法:Julie Lerman 的有关使用 POCO 的视频使用实体框架生成 T4 代码
如今,大多数人都使用实体框架而不是数据读取器。但是,T4 模板是可定制的。您可以修改 T4 DAL 模板以使用数据读取器而不是实体框架。
This video demonstrates an approach similar to what you are seeking: Julie Lerman's video on Using the POCO T4 Code Generation with the Entity Framework
Most people use the Entity Framework these days instead of datareaders. However, the T4 templates are customizable. You could modify the T4 DAL template to use a datareader instead of the Entity Framwork.