EntityFramework核心加载一些记录太慢

时间:2018-12-26 10:50:50

标签: c# entity-framework entity-framework-core

EF核心负载记录太慢。我的代码哪里出错了?

这是我的代码:

它是GoodsName的实体:

public class GoodsName
{
   //..

        public string Name { get;  set; }

  public virtual ICollection<GoodsName_CompanyClient> GoodsName_CompanyClientList { get; set; }

//..
}

它是GoodsName_CompanyClient的实体,它是多对多的:

public  class GoodsName_CompanyClient
    {
        public Guid Id { get; set; }


        public GoodsName GoodsName { get; set; }


        public Guid FKForGoodsNameId { get; set; }



        public CompanyClient CompanyClient { get; set; }


        public Guid FKForCompanyClientId { get; set; }
    }


var companyClientList=searchModel.CompanyClientList;

 where = where.And(a =>
                      a.GoodsName_CompanyClientList.Any(c => 
                      companyClientList.Any(d => d.Id == c.FKForCompanyClientId))
                  );

0 个答案:

没有答案