How do I return a bit from a stored procedure with nHibernate
Posted
by tigermain
on Stack Overflow
See other posts from Stack Overflow
or by tigermain
Published on 2010-04-28T17:37:30Z
Indexed on
2010/04/28
17:47 UTC
Read the original article
Hit count: 313
nhibernate
|c#
I am using nHibernate in my project but I have a stored procedure which just returns a boolen of success or now.
How do I code this in c#?
I have tried the following but it doesnt like cause I dont have a mapping for bool!!!
{"No persister for: System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"}
IQuery query = NHibernateSession.CreateSQLQuery("EXEC MyDatabase.dbo.[ContentProvider_Import] :ContentProviderImportLogId", "success", typeof(bool))
.SetInt32("ContentProviderImportLogId", log.Id);
var test = query.UniqueResult<bool>();
and the same result from
IQuery query = NHibernateSession.CreateSQLQuery("EXEC MyDatabase.dbo.[ContentProvider_Import] :ContentProviderImportLogId")
.AddEntity(typeof(bool))
.SetInt32("ContentProviderImportLogId", log.Id);
var test = query.UniqueResult<bool>();
© Stack Overflow or respective owner