简体   繁体   English

从Nhibernate 3.3获取SqlConnection

[英]Get SqlConnection from Nhibernate 3.3

I want to use Pivot with a named query with nhibernate 3.3 and use it in a GridView. 我想使用带有nhibernate 3.3的命名查询的Pivot并在GridView中使用它。

I saw on NHibernate, Pivot-table and/or GetNextID() that I can use result transformer but I can't predict what will be the fields. 我在NHibernate,Pivot-table和/或GetNextID()上看到我可以使用结果转换器,但我无法预测字段是什么。 (So a bean isn't possible I think, and I need to have named column) (所以我认为bean不可能,我需要命名列)

So the best solution is to use a named query and put it in a DataTable. 所以最好的解决方案是使用命名查询并将其放在DataTable中。

Is there a easy way to get the data and put it in a DataTable. 有没有一种简单的方法来获取数据并将其放入DataTable中。 A method would be to retrieve the SqlConnection from nhibernate and use it to retrieve the data returned by the stored procedure. 一种方法是从nhibernate检索SqlConnection并使用它来检索存储过程返回的数据。 But does someone how to do that ? 但有人怎么做?

Regards 问候

NHibernates ISession接口具有属性Connection ,它提供了底层的ADO.NET连接对象。

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

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