简体   繁体   English

Fluent-NHibernate是否支持到过程的映射?

[英]Does Fluent-NHibernate support mapping to procedures?

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. 我一直在想是否可以让Fluent-NHibernate与已经存在的存储过程进行通信,并从结果集中将映射分配给我自己的域对象。

Also is Fluent-NHibernate able to directly execute procedures with no result set returned? Fluent-NHibernate是否能够直接执行过程而没有返回结果集?

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. 基本上,我一直在考虑使用Fluent-NHibernate将其过时的TypedDataSet模型替换为可以从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. 如果Fluent-NHibernate不能轻松地与SP一起使用,我想我会最喜欢使用组合DAL,该DAL将利用FNH进行简单的CRUD操作,而使复杂的过程由企业库管理。 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. 虽然我认为如果FNH无法与SP很好地配合使用,最好不要有两个竞争的DAL,但除了结合使用EntLib和FNH之外,我还想听听其他想法。

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. 仅回答我自己的问题,答案无非就是您可以为NHibernate编写xml映射并将它们与Fluent-NHibernate映射结合起来。 SP mapping for FNH will most likely be added later. FNH的SP映射很可能会在以后添加。

The trunk version of Fluent NHibernate (on GitHub) supports insert, update and delete stored procedures. Fluent NHibernate的主干版本(在GitHub上)支持插入,更新和删除存储过程。

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. 有关更多信息,请参见Fluent NHibernate Google Group中的该线程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM