亚音速表映射
我搜索了很多,但还没有真正找到答案。
是否可以将 POCO 与 Subsonic 一起使用? 如何将表(看起来不像 POCO)映射到我的类?
I've searched a lot and I haven't really found an answer.
Is it possible to use POCOs with Subsonic?
How do I map tables (which do not look like the POCOs) to my classes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SubSonic 不提供将表映射到 POCO 的内置方法。
最接近的方法是使用 SubSonic 的 ActiveRecord 部分,它将为每个表生成一个类(具有每个表列的属性以及与其他表的外键关系)。
根据 POCO 的外观,您可能能够(或不能)在生成的 ActiveRecord 类和 POCO 之间轻松获取数据。此外,生成的 ActiveRecord 类是通过模板创建的,您可以对其进行修改以满足您的需求。
SubSonic doesn't provide a built in way to map tables to your POCOs.
The closest it would come would be using the ActiveRecord portion of SubSonic which would generate one class per table (with properties for each table column and foreign key relationship to other tables).
Depending on how your POCOs look, you might be able to get data easily (or not) between the generated ActiveRecord classes and your POCOs. Also, the generated ActiveRecord classes are created via templates which you can modify to fit your needs.