shuxinqin / Chloe

A lightweight and high-performance Object/Relational Mapping(ORM) library for .NET --C#
https://github.com/shuxinqin/Chloe/wiki
MIT License
1.52k stars 457 forks source link

'xxx' is not navigation property. #263

Closed cty901 closed 3 years ago

cty901 commented 3 years ago

我的实体这样定义的: [ColumnAttribute("F_Id", IsPrimaryKey = true)] public string F_Id { get; set; }

    [Required(ErrorMessage = "省份不能为空")]
    //[NavigationAttribute]
    public string ProvinceCode { get; set; }

    [NavigationAttribute("ProvinceCode")]
    public SystemManage.AreaEntity ProvinceEntity { get; set; }

查询语句是: var query = repository.IQueryable().IncludeMany(b=>b.ProvinceCode).Where(a => a.F_DeleteMark == false); 然后运行代码,就提示: 'ProvinceCode' is not navigation property.

请问要怎么设置才能自动把省份数据查出来?

shuxinqin commented 3 years ago

Include(b=>b.ProvinceEntity)

cty901 commented 3 years ago

Include(b=>b.ProvinceEntity)

感谢作者,是我自己搞混了~~已解决~感谢感谢。