相关疑难解决方法(0)

在此上下文中仅支持实体类型,枚举类型或基元类型

我目前正在搜索搜索页面.我只需要返回包含存储在int [] ST中的所有主题标签id的主题的themedetails列表.目前行(ST == null?true:ST.Contains(b.ThemeTagID))似乎给我一个错误

附加信息:无法创建类型为"System.Int32 []"的空常量值.在此上下文中仅支持实体类型,枚举类型或基元类型.

    public ActionResult Index(int ProviderID = 0, string Description = null, int[] ST = null)
    {

        var themedetail = from t in db.ThemeDetail
                          from b in t.ThemeTags
                          where (
                          (string.IsNullOrEmpty(Description) ? true : t.Description.ToLower().Contains(Description.ToLower())) &&
                          (ProviderID == 0 ? true : t.ProviderID == ProviderID) &&
                          (ST == null ? true : ST.Contains(b.ThemeTagID))
                              )
                          select t;

        ViewBag.ProviderID = new SelectList(db.ProviderDetails, "ProviderID", "ProviderName");
        ViewBag.MultiselectFeatures = new MultiSelectList(db.ThemeFeatures, "ThemeFeatureID", "ThemeFeaturesName");
        ViewBag.MultiselectTags = new MultiSelectList(db.ThemeTags, "ThemeTagID", "TagName");

        return …
Run Code Online (Sandbox Code Playgroud)

c# linq entity-framework

3
推荐指数
1
解决办法
2886
查看次数

标签 统计

c# ×1

entity-framework ×1

linq ×1