zoukankan      html  css  js  c++  java
  • LINQ to Entities 不识别方法“System.String ToString()”,因此该方法无法转换为存储表达式。

    LINQ to Entities 不识别方法“System.String ToString()”,因此该方法无法转换为存储表达式。

    行 34:         public ActionResult CreateUser ()
    行 35:         {
    行 36:             ViewBag.DeptTypes = _dbContext.DepartmentTypes.Select(x => new SelectListItem() { Text = x.Description, Value = x.Id.ToString() }).ToList();
    行 37:             return View();
    行 38:         }


    解决方法:Select前ToList()或ToArray()
    行 34:         public ActionResult CreateUser ()
    行 35:         {
    行 36:             ViewBag.DeptTypes = _dbContext.DepartmentTypes.ToList().Select(x => new SelectListItem() { Text = x.Description, Value = x.Id.ToString() }).ToList();
    行 37:             return View();
    行 38:         }
  • 相关阅读:
    Vue
    linux-----docker
    linux基础
    Flask基础
    websocket
    css
    Mysql数据库基础
    IO多路复用
    线程和协程
    sh_02_del关键字
  • 原文地址:https://www.cnblogs.com/gitran/p/3277263.html
Copyright © 2011-2022 走看看