Does Fluent-NHibernate support mapping to procedures?

耗尽温柔 提交于 2019-12-20 19:39:02

问题


I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects.

Also is Fluent-NHibernate able to directly execute procedures with no result set returned?

Basically I've been considering the implications of using Fluent-NHibernate to replace a dated TypedDataSet model with a domain driven design that can return simple objects from the DAL. If Fluent-NHibernate cannot work with SPs easily, I think I would most likley have a combinational DAL that will take advantage of FNH for simple CRUD operations while leaving complex procedures to be managed by Enterprise Library. While I don't think it would be optimal to have 2 competing DALs if FNH cannot play well with SPs I'd love to hear any other ideas than using both EntLib and FNH together.


回答1:


The trunk version of Fluent NHibernate (on GitHub) supports insert, update and delete stored procedures.

In your mapping class constructor, call:

SqlInsert("StoredProcName");

Disclaimer: I haven't tested this myself yet, but it certainly will come in handy soon.

For more info see this thread in the Fluent NHibernate Google Group.




回答2:


Just to answer my own question, the answer is no other than you can write xml mapppings for NHibernate and combine them with Fluent-NHibernate mappings. SP mapping for FNH will most likely be added later.



来源:https://stackoverflow.com/questions/296732/does-fluent-nhibernate-support-mapping-to-procedures

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!