使用 Fluent nHibernate 删除的存储过程
我已经看过有关该主题的其他一些帖子,但大多数似乎都在处理选择。我有一个存储过程,它执行大量删除和检查,并且仅接受一个 int 作为参数,并返回一点以表示成功。我想使用来自锐利架构的流畅 nHibernate 从我的代码中启动它。
关于如何最好地解决这个问题有什么想法吗? 谢谢
I've had a look at some of the other posts on the topic but most seem to be dealing with selects. I've got a stored procedure that does a number of deletes and checks and simply takes in one int as an argument and returns a bit for success. I want to fire this off from my code using fluent nHibernate from sharp architecture.
Any Ideas on how best to tackle this?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您还无法使用 FluentNHibernate 映射存储过程(AFAIK)。您需要这样的 xml 映射 (SQL-Server):
如果您使用 NHibernate 调用它,返回值可能是
object[]
的ArrayList
。注意“?”参数,它将获取你的 id。调用的名称将为“DeleteSomeEntity”。另请记住,您必须使用约定“.hbm.xml”来命名该文件,并且需要将其作为嵌入式资源包含在您的项目中!为了让 FluentNHibernate 加载该文件,您需要
在初始化映射时调用调用 xml 的程序集。
当您确实需要映射的返回类型时,可以在映射中包含
或
声明。不过我还没有这样做,你必须在 NHibernate 参考手册中查找它。HTH。
You cannot map stored procedures with FluentNHibernate yet (AFAIK). You need an xml mapping like this (SQL-Server):
The return value will probably be an
ArrayList
ofobject[]
if you call it with NHibernate. Notice the '?' argument, which will take your id. The name to call will be "DeleteSomeEntity" Also remember, that you'll have to name the file with the convention ".hbm.xml" and you need to include it as an embedded resource in your project!For FluentNHibernate to load the file, you'll need to call
on the assembly calling the xml when initializing your mappings.
When you really need the return-type mapped, you can include a
<return>
or<return-property>
declaration in the mapping. I haven't done this, though, you'd have to look it up in the NHibernate reference manual.HTH.