由于某种原因,我在使用 $select=Gallery/Categories 查询(投影)时不断收到错误。我得到的错误是:
“无法在类型 'System.Collections.Generic.ICollection`1[Web.Core.Models.GalleryModel]' 上找到属性 'Categories'。”
这是我目前的模型:
public class GalleryModel : BaseModel
{
public ICollection<CategoryModel> Categories { get; set; }
}
BaseModel 仅具有一些其他属性的地方..例如
public int Id { get; set; }
public string Name { get; set; }
public DateTime Updated { get; set; }
任何想法为什么它可能会抛出这个错误?奇怪的是,如果我不添加我的投影,那么它似乎找到了属性并用成熟的 json 响应。
提前致谢!