المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : NHibernate - where clause include result from a STORED PROC



C# Programming
04-22-2009, 03:13 PM
NHibernate - where clause include result from a STORED PROC?

I have this stored procedure "spIsAuthorized" with an OUT param "IsAuthorized" of type CHAR (Y=yes authorized and N=not authorized)

Now my question is, without access control checking I normally load the objects using ICriteria/or/IQuery


IQuery oQuery.SetMaxResults(nMaxResults);
IList lstResult = oQuery.List();
...
OR
...
ICriteria oCriteria.SetMaxResults(nMaxResults);
IList lstResult = oCriteria.List();


Now how do I filter (add to oCriteria or where-clause of oQuery) so that only those authorized is returned? Basically I want to do something like this:


oCriteria.Add( Expression.Eq("spIsAuthorized", "UserId=123,ActionId=2", "Y") )


* spIsAuthorized=stored proc
* UserId and ActionId are input param to stored proc
* Y = output param of stored proc, "IsAuthorized".

Thanks!

dev