IT小易 2019-08-27 13:19 采纳率: 33.3%
浏览 508
已采纳

asp.net core+EF架构查询数据库时报错

asp.net core+EF架构查询数据库时报错
Entities代码

[Table("Dictionary")]
    [Serializable]
    public partial class Dictionary
    {
        /// <summary>
        /// 数据字典ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 字典名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 字典编码
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 数据类型
        /// </summary>
        public int? Type { get; set; }

        /// <summary>
        /// 父级ID
        /// </summary>
        public Guid Pid { get; set; }

        /// <summary>
        /// 排序权重
        /// </summary>
        public int? Sort { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        public bool Enabled { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool Deleted { get; set; }

        /// <summary>
        /// 创建用户ID
        /// </summary>
        public Guid CreateId { get; set; }

        /// <summary>
        /// 创建日期
        /// </summary>
        public DateTime? CreateTime { get; set; }

        /// <summary>
        /// 更新用户ID
        /// </summary>
        public Guid UpdateId { get; set; }

        /// <summary>
        ///更新日期 
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
    }
上下文代码

public class EntityDbContext : DbContext
    {
        public EntityDbContext(DbContextOptions options) : base(options)
        {

        }
        public DbSet<Category> Categories { get; set; }
        public DbSet<SysUser> SysUsers { get; set; }
        public DbSet<SysUserToken> SysUserTokenes { get; set; }
        public DbSet<SysUserLoginLog> SysUserLoginLogs { get; set; }
        public DbSet<SysUserRole> SysUserRoles { get; set; }
        public DbSet<SysPermission> SysPermissions { get; set; }
        public DbSet<Dictionary> Dictionaries { get; set; }
    }

        调用代码
        private IRepository<Entities.Dictionary> _dictionaryRepository;
        private IHttpContextAccessor _accessor;

        public DictionaryService(IRepository<Entities.Dictionary> dictionaryRepository, IHttpContextAccessor accessor)
        {
            this._dictionaryRepository = dictionaryRepository;
            this._accessor = accessor;
        }
        /// <summary>
        /// 获取所有数据字典并缓存
        /// </summary>
        /// <returns></returns>
        public List<Entities.Dictionary> getAll()
        {
            var result = _dictionaryRepository.Table.Where(o => !o.Deleted);
            var ex = result.Expression;
            //result = result.Where(o => o.Code == "KGJ-2019-T-001" || o.Code == "KGJ-2019-T-002");
            //return result.OrderBy(o => o.Type).ThenBy(o => o.CreateTime).ToList();
            throw new NotImplementedException(ex.ToString());
        }

报错问题:图片说明

  • 写回答

2条回答 默认 最新

  • threenewbee 2019-08-27 13:35
    关注

    throw new NotImplementedException(ex.ToString());
    这个去掉。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 MATLAB APP 制作出现问题
  • ¥15 wannier复现图像时berry曲率极值点与高对称点严重偏移
  • ¥15 利用决策森林为什么会出现这样·的问题(关键词-情感分析)
  • ¥15 DispatcherServlet.noHandlerFound No mapping found for HTTP request with URI[/untitled30_war_e
  • ¥15 使用deepspeed训练,发现想要训练的参数没有梯度
  • ¥15 寻找一块做为智能割草机的驱动板(标签-stm32|关键词-m3)
  • ¥15 信息管理系统的查找和排序
  • ¥15 基于STM32,电机驱动模块为L298N,四路运放电磁传感器,三轮智能小车电磁组电磁循迹(两个电机,一个万向轮),怎么用读取的电磁传感器信号表示小车所在的位置
  • ¥15 如何解决y_true和y_predict数据类型不匹配的问题(相关搜索:机器学习)
  • ¥15 PB中矩阵文本型数据的总计问题。