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 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条