如何使用 PetaPoco 显式包含映射表
我想在大约有 600 个表的表上使用 PetaPoco,但我只想映射少数表。
有没有办法明确说明我想要映射的表? t4 模板中的配置 (tables["tablename"].Ignore = true
) 并不能真正适应这种方法?
I want to use PetaPoco on a table that has circa 600 tables, but I only want to map a handful of the tables.
Is there a way to explicitly state the tables I want mapping? The config in the t4 template (tables["tablename"].Ignore = true
) doesn't really scale to this approach?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终这样做了:
I ended up doing it like this:
我做过类似的事情
I have done something similar
为了避免 T4 模板充满忽略分配,我创建了一个只能访问我需要的表的新数据库用户。
然后我将 T4 模板与数据库用户连接,PetaPoco 只看到了我需要的表。
To avoid having a T4 template filled with ignore assignments, I made a new database user that only had access to the tables I needed.
Then I connected the T4 template with the database user and PetaPoco only saw the tables I needed.