普通 T4 DAL 模板和 poco 生成

发布于 2024-11-27 04:22:05 字数 153 浏览 0 评论 0原文

我正在寻找 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生死何惧 2024-12-04 04:22:05

该视频演示了与您正在寻找的方法类似的方法: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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文