Reputation: 1550
Lets say my stored procedure is something like
create procedure mySp
As
select a, b, c, d, e from aTable
End
I want to get the value of d
for the last row. That is the only value that I am interested in. I don't want to map the result to a C# object or anything. Just need the value of d
for the last row.
What should my nhibernate query look like? Here is how I would start the call. But I can't get to the rest of it:
return unitOfWork.Session.CreateSQLQuery("exec mySP"). ??
Upvotes: 0
Views: 89
Reputation: 6741
You want to use Object-Relational Mapping tool but without objects and mapping. The most convenient way - don't do this, just use old-school SqlCommand
for that.
if all you have is a hammer, everything looks like a nail
Upvotes: 1
Reputation: 11782
If you have a requirement to get some value out of a stored procedure, but don't or won't map it to another object, then just expose a connection in your UnitOfWork interface.
Or simply add "int MySpecialDbCall()" method and call it a day.
It's "ugly" but I've had to do a similar thing.
Upvotes: 0