问题
Is it possible to construct a DetachedCriteria in nHibernate which queries a stored procedure? How would I accomplish such a task?
回答1:
I have not done it but you can use some alternatives:
- Named Queries and SQL Queries
- Map to a view instead.
- Map to a TableValued Function (yes this I know this isn't great but it's got me out of a few jams)
回答2:
No, it's not possible.
You have to use a SQLQuery to call a stored procedure.
来源:https://stackoverflow.com/questions/6611124/call-a-stored-procedure-with-a-detachedcriteria