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条)

报告相同问题?

悬赏问题

  • ¥30 微信小程序请求失败,网页能正常带锁访问
  • ¥15 对语音信号进行变调时,间接改变时序从而实现语音变速,进而将变调与变速同时实现、参数合成法换为波形合成法
  • ¥30 德飞莱51单片机实现C4炸弹
  • ¥50 CrossLink-LIF-MD6000 型 FPGA 的 CMOS 转 MIPI D-PHY IP 核功能使用异常
  • ¥15 proteus控制16x16LED点阵显示屏的设计
  • ¥30 求会做山景bp1048b2程序的。做直播声卡用
  • ¥15 求数学建模论文问题指导
  • ¥15 51单片机与数码管实现电子琴
  • ¥15 h3.6m 人类行为预测论文复现
  • ¥50 wordpress项目注册报失败刷新后其实是成功状态,请求排查原因