Asp.net mvc 指定的包含路径无效。EntityType未声明名称为的导航属性

Asp.net mvc 指定的包含路径无效。EntityType未声明名称为的导航属性,asp.net-mvc,controller,Asp.net Mvc,Controller,我下面的代码可以工作。它会将我的一个存储库中的每一项都拉入一个列表 当我添加第二个表以从该表中提取所有项时,我得到以下错误,在我的数据2上,我无法理解为什么它会抛出此错误,因为第一个表是以完全相同的方式编程的 “指定的包含路径无效。EntityType未声明名为的导航属性” 查看模型 public IList<OneVM> Ones { get; set; } public IList<TwoVM> Twos { get; set; } public ViewModelV

我下面的代码可以工作。它会将我的一个存储库中的每一项都拉入一个列表

当我添加第二个表以从该表中提取所有项时,我得到以下错误,在我的数据2上,我无法理解为什么它会抛出此错误,因为第一个表是以完全相同的方式编程的

“指定的包含路径无效。EntityType未声明名为的导航属性”

查看模型

public IList<OneVM> Ones { get; set; }
public IList<TwoVM> Twos { get; set; }
public ViewModelVM()
{
    this.Ones = new List<OneVM>();
    this.Twos = new List<TwoVM>();
}
public-IList-one{get;set;}
公共IList two{get;set;}
公共ViewModelVM()
{
this.Ones=新列表();
this.Twos=新列表();
}
以下工作原始代码(控制器)

public ActionResult目录()
{
var vm=新的ViewModelVM();
var data=_OneRepository.GetData();
vm.Datas=_mapper.Map(Datas.OrderBy(i=>i.Name));
返回视图(vm);
}
下面所需的断开代码(控制器)

public ActionResult目录()
{
var vm=new FormDirectoryVM();
var data=_OneRepository.GetData();
var datastow=_tworrepository.GetMoreData();
vm.Datas=_mapper.Map(Datas.OrderBy(i=>i.Name));
返回视图(vm);
vm.DatasTwo=_mapper.Map(DatasTwo);
返回视图(vm);
}

问题出在我的存储库上。我包括了一些不需要的东西

 public IEnumerable<Two> GetMoreData()
        {
            return _context.Twos
                .Include(i => i.Title) // I don't need this line
                .Include(i => i.Description) // I don't need this line either
                .Include(i => i.Keywords)
                .Include(j => j.Text) // Or this Line
                .Where(i => !i.IsDeleted)
             ;
        }
public IEnumerable GetMoreData()
{
return\u context.Twos
.Include(i=>i.Title)//我不需要这行
.Include(i=>i.Description)//我也不需要这一行
.Include(i=>i.Keywords)
.Include(j=>j.Text)//或此行
.其中(i=>!i.IsDeleted)
;
}

\u OneRepository.GetData().AsEnumerable().Concat(\u TwoRepository.GetMoreData())恐怕这会给我同样的错误。
    public ActionResult Directory()
    {
 var vm = new FormDirectoryVM();
            var datas = _OneRepository.GetData();
            var datasTwo= _TwoRepository.GetMoreData();
            vm.Datas = _mapper.Map<IList<DataVM>>(datas.OrderBy(i => i.Name)); 
        return View(vm);
            vm.DatasTwo= _mapper.Map<IList<DataTwoVM>>(datasTwo);
return View(vm);
}
 public IEnumerable<Two> GetMoreData()
        {
            return _context.Twos
                .Include(i => i.Title) // I don't need this line
                .Include(i => i.Description) // I don't need this line either
                .Include(i => i.Keywords)
                .Include(j => j.Text) // Or this Line
                .Where(i => !i.IsDeleted)
             ;
        }