是否有像 iBATIS.NET 一样的查询映射器,但具有脏跟踪、延迟加载和级联更新功能?
问题:
- DBA 控制的数据库具有仅存储过程的授权。
- 期望在 POCO 中定义域。
因此,我决定需要一个专为存储过程和/或遗留数据库设计的 ORM。
理想情况下,ORM 应该允许我以声明方式(或流畅地)将域对象映射到 CRUD 存储过程。
到目前为止的一些发现:
- 只要我能够控制为延迟加载生成的查询,NHibernate 就会起作用。
- iBATIS.NET 可以完美工作,但我找不到任何示例:
- 对象状态跟踪(新/更新/删除/等)
- 父/子提交事务(如果更新了父对象,则也更新所有脏子对象)。
- 内部开发的与我们的数据库约定兼容的 ORM 是一种选择,我们已经开始使用它。但我想确保我们没有其他选择。
非选项:
- SubSonic 确实包装存储过程,但它不在过程和实体之间映射。如果需要的话,我可以实现某种映射器,但还有其他因素对 SubSonic 不利,例如缺乏 VS2005(或 SharpDevelop)支持以及将数据访问与域对象混合在一起。
- 删除 SProcs 不是一个选项。数据完整性是 DBA 和高层非常关心的问题,他们觉得 SPprocs 是最安全的。我无权说服他们。
有谁知道适合我的需求的 ORM,或者或者克服 100% 不适合我的需求的 ORM 的限制的方法?
欢迎任何建议!
The problem:
- A DBA-controlled database with a Stored Procedure-only mandate.
- An expectation that the domain be defined in POCO's.
So I decided that I need an ORM designed for stored procedures and/or legacy databases.
Ideally the ORM should allow me to declaratively (or fluently) map domain objects to CRUD stored procedures.
Some findings thus far:
- NHibernate would work if only I could control the queries that are generated for lazy-loading.
- iBATIS.NET would work perfectly, but I can't find any examples of:
- object state tracking (new/updated/deleted/etc)
- parent/child commit transactions (if a parent is updated, update all dirty child objects as well).
- An In-House developed ORM that works with our database conventions is an option and we have already started with this. But I want to make sure we don't have any other choice.
Non-Options:
- SubSonic does wrap stored procs, but it doesn't map between procs and entities. I could implement a mapper of some sort if it came to it, but there are other factors also weighting against SubSonic, such as lacking VS2005 (or SharpDevelop) support and mingling data-access with domain objects.
- Dropping the SProcs is not an option. Data integrity is a HUGE concern for the DBA's and the higher-ups and they feel safest with SProcs. It's not my place to convince them otherwise.
Does anyone know of an ORM that suits my needs, or a way to overcome the limitations in an ORM that doesn't suit my needs 100%?
Any suggestions welcome!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 NHibernate 是你最好的选择。
您可以使用 loader、sql-insert、sql-delete、sql-update 元素来配置实体和延迟加载集合的存储过程,尽管这意味着相当多的击键。
I think NHibernate is your best bet.
You can use loader, sql-insert, sql-delete, sql-update elements to configure store procs for entities and lazy load collections, although it means quite a lot of keystrokes.