将存储过程转换为nhibernate创建条件

时间:2013-09-25 17:52:20

标签: nhibernate stored-procedures createcriteria

我有一个sql stored procedure,我想在CreateCriteria转换它。我无法转换它。 SP在下面给出

BEGIN  
  SELECT     *  
  FROM       tSCProperty  
  WHERE    fCompanyID = @CompanyID  
  ORDER BY fName  
 END  
ELSE  
 BEGIN  
  SELECT @UserID = fUserID  
  FROM tUMUser  
  WHERE fUserName = @UserName   

  IF @UserID IS NULL  
   BEGIN  
    SELECT DISTINCT NULL FROM tSCProperty  
   END  
  ELSE  
   BEGIN   
    SELECT * FROM tSCProperty  
    WHERE fCompanyID = @CompanyID  
     AND fPropertyID IN (SELECT fPropertyID FROM tUMUser [user]  
        INNER JOIN tUMUserAccess ua ON [user].fUserID = ua.fUserID  
        INNER JOIN tUMPropertyAccess pa ON ua.fGroupID = pa.fGroupID  
        WHERE [user].fUserID = @UserID  
        AND fPropertyID IS NOT NULL)  
    ORDER BY fName  
   END  

我是Nhibernate的新手。我被困在这个存储过程中。任何帮助将不胜感激。谢谢。

0 个答案:

没有答案