So I decided to just create a string to assign the exec sproc query to as a 
ISQLQuery.

Maybe you can offer a quick note on this.
If I don't care about what the sproc returns what in the following would I 
change?  (I wouldn't ask normally but I'm going to go on with other things 
in hopes that you can reply with a quick tip for me)

Currently the sproc completes on: "*select 'ThereYouGo' as 'ret' -- because 
for some reason every proc returns a recordset as far as nHibernate is 
concerned*"

----
        public void myDaoFunct(int myInt1, string myStr1, string myStr2, 
int myint2)
        {
            string sql = string.Format("exec MySproc {0}, '{1}', '{2}', 
{3}", myInt1, myStr1, myStr2, myInt2);
            ISQLQuery qry = 
NHibernateSessionManager.Instance.GetSession().CreateSQLQuery(sql);
            
qry.SetResultTransformer(NHibernate.Transform.Transformers.AliasToBean(typeof(retMyType)));
        }
---- and 'retMyType' is: 
        class retMyType {
            string ret;
        }
----


Thanks.
-Steve





On Wednesday, August 10, 2016 at 5:43:14 PM UTC-4, Steve Lyle wrote:
>
>
> I inherited a project that has been around for a few years.
> The project utilizes a Domain/Interface/Dao model in ASP.NET.
>
> -----
> The Dao executes numerous queries using ICriteria such as:
>             ICriteria criteria = 
> NHibernateSessionManager.Instance.GetSession().CreateCriteria(typeof(MyEntity));
>             criteria.Add(Expression.Eq("id", id));
>             return criteria.UniqueResult<MyEntity>();
> -----
>
>
> I'm trying to execute a sproc using a Named Query.
> For numerous reasons I like to do so in this fashion:
> ------
>             using (ISession ses = NHibernateISession.OpenSession())
>             {
>                 IQuery qry = ses.GetNamedQuery("MySproc");
>                 qry.SetParameter("param1", param1);
>                 qry.UniqueResult();
> -----
>
>
> How do I get session from SessionManager when GetSession() returns 
> ISessionBase?
> or
> How do I execute a named query from an ISessionBase?
>
>
>
> NHibernateSessionManager doesn't have a method that returns a ISession.
> NHibernateSessionManager is in a separate "Core" project which I am 
> probably not going to be able to touch.
> All projects are wired together via Spring.
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to