日期:2014-05-17  浏览次数:20634 次

如何设置IQueryable的类型为函数返回的类型??

private IQueryable GetArticleQueryByColumnID(long columnID)
        {
            string sqlStr = "";
            if (columnID > 0)
            {
                sqlStr = string.Format(ExSql, string.Format(" and COLUMN_ID={0} ", columnID));
            }
            else
            {
                sqlStr = string.Format(ExSql, "");
            }
            switch (GetColumn(columnID).REFER_TYPE)
            {
                case 0:
                    return _db.ExecuteQuery<V_ARTICLE_SHOW_ALL>(sqlStr).AsQueryable();
                case 1:
                    return _db.ExecuteQuery<V_ARTICLE_SHOW_REFER>(sqlStr).AsQueryable();
                case 2:
                    return _db.ExecuteQuery<V_ARTICLE_SHOW_REFER>(sqlStr).AsQueryable();
                case 3:
                    return _db.ExecuteQuery<V_ARTICLE_SHOW_DUTYTREE>(sqlStr).AsQueryable();
                default:
                    return _db.ExecuteQuery<V_ARTICLE_SHOW_REFER_ALL>(sqlStr).AsQueryable();
            }