Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/325.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架多对多Can';我得不到相关数据_C#_Entity Framework_Entity - Fatal编程技术网

C# 实体框架多对多Can';我得不到相关数据

C# 实体框架多对多Can';我得不到相关数据,c#,entity-framework,entity,C#,Entity Framework,Entity,试图从多对多的桌子上收集,但运气不佳。 目前有3个表。我不知道如何访问每个作业的SkillPool_lookup.skillname 我现在有 using(Entities dbCtx = new Entities()) { this.JobList = dbCtx.Jobs.Where(x => x.JobStatusId == 1) .Include(x => x.JobStatus_Lookup)

试图从多对多的桌子上收集,但运气不佳。 目前有3个表。我不知道如何访问每个作业的SkillPool_lookup.skillname

我现在有

 using(Entities dbCtx = new Entities())
       {
           this.JobList = dbCtx.Jobs.Where(x => x.JobStatusId == 1)
            .Include(x => x.JobStatus_Lookup)
            .Include(x => x.Budget_Lookup)
            .Include(x => x.JobCategories_Lookup)
            .Include(x => x.JobType_Lookup)
            .Include(x => x.Job_SubCategories_Lookup)
            .Include(x => x.TimeLine_Lookup)
            .Include(x => x.RequiredJobSkills)
            .OrderByDescending(x => x.DateCreated)
            .ToList();


        }
但是Requirejobskills.skillpool\u查找始终为空???卡住了。请帮忙

public Job()
        {
            this.RequiredJobSkills = new HashSet<RequiredJobSkill>();
            this.JobReporteds = new HashSet<JobReported>();
            this.JobsEmaileds = new HashSet<JobsEmailed>();
            this.JobsSaveds = new HashSet<JobsSaved>();
        }

        public int Id { get; set; }
        public string Description { get; set; }
        public string UserId { get; set; }
        public int QuoteCount { get; set; }
        public int BudgetAmountId { get; set; }
        public int MaxBidCount { get; set; }
        public int JobCategoryId { get; set; }
        public int JobStatusId { get; set; }
        public System.DateTime DateCreated { get; set; }
        public int JobCategorySubCatId { get; set; }
        public int JobTypeId { get; set; }
        public string Title { get; set; }
        public int QuoteCountryOfOrginId { get; set; }
        public Nullable<System.DateTime> DateFilled { get; set; }
        public Nullable<System.DateTime> DateCanceled { get; set; }
        public Nullable<System.DateTime> DateCompleted { get; set; }
        public int TimeLineId { get; set; }
        public Nullable<System.Guid> UserIdentifier { get; set; }
        public System.Guid JobIdentifier { get; set; }
        public Nullable<int> UnseenQuotesCount { get; set; }
        public Nullable<int> UnseenMessagesCount { get; set; }

        public  Budget_Lookup Budget_Lookup { get; set; }
        public  Job_SubCategories_Lookup Job_SubCategories_Lookup { get; set; }
        public  JobCategories_Lookup JobCategories_Lookup { get; set; }
        public  JobStatus_Lookup JobStatus_Lookup { get; set; }
        public  JobType_Lookup JobType_Lookup { get; set; }
        public  TimeLine_Lookup TimeLine_Lookup { get; set; }
        public  ICollection<RequiredJobSkill> RequiredJobSkills { get; set; }
        public  ICollection<JobReported> JobReporteds { get; set; }
        public  ICollection<JobsEmailed> JobsEmaileds { get; set; }

        public  ICollection<JobsSaved> JobsSaveds { get; set; }
    }

 public partial class RequiredJobSkill
    {
        public int Id { get; set; }
        public int SkillId { get; set; }
        public int JobId { get; set; }
        public  Job Job { get; set; }
        public  SkillPool_lookup SkillPool_lookup { get; set; }
    }

public partial class SkillPool_lookup
    {
        public SkillPool_lookup()
        {
            this.UserSkills = new HashSet<UserSkill>();
            this.RequiredJobSkills = new HashSet<RequiredJobSkill>();
        }

        public int Id { get; set; }
        public string SkillName { get; set; }
        public string Description { get; set; }
        public  ICollection<UserSkill> UserSkills { get; set; }
        public  ICollection<RequiredJobSkill> RequiredJobSkills { get; set; }
    }
公共作业()
{
this.RequiredJobSkills=new HashSet();
this.JobReporteds=new HashSet();
this.JobsEmaileds=new HashSet();
this.JobsSaveds=新HashSet();
}
公共int Id{get;set;}
公共字符串说明{get;set;}
公共字符串用户标识{get;set;}
public int QuoteCount{get;set;}
public int BudgetAmountId{get;set;}
public int MaxBidCount{get;set;}
public int-JobCategoryId{get;set;}
public int JobStatusId{get;set;}
public System.DateTime DateCreated{get;set;}
public int-JobCategorySubCatId{get;set;}
public int JobTypeId{get;set;}
公共字符串标题{get;set;}
public int quoteCountryofginID{get;set;}
可为空的公共日期填充{get;set;}
公共可为空的日期取消{get;set;}
可为空的公共日期已完成{get;set;}
public int TimeLineId{get;set;}
公共可为空的用户标识符{get;set;}
public System.Guid作业标识符{get;set;}
公共可空的不可见QuotesCount{get;set;}
公共可为空的不可见MessageScont{get;set;}
公共预算查找预算查找{get;set;}
公共作业\子类别\查找作业\子类别\查找{get;set;}
public JobCategories_Lookup JobCategories_Lookup{get;set;}
公共作业状态\查找作业状态\查找{get;set;}
public JobType_Lookup JobType_Lookup{get;set;}
公共时间线\u查找时间线\u查找{get;set;}
公共ICollection RequiredJobSkills{get;set;}
公共ICollection JobReporteds{get;set;}
公共ICollection作业文件{get;set;}
公共ICollection JobsSaveds{get;set;}
}
公共部分课程要求职业技能
{
公共int Id{get;set;}
公共int SkillId{get;set;}
public int JobId{get;set;}
公共作业作业{get;set;}
公共技能库_查找技能库_查找{get;set;}
}
公共部分类SkillPool_查找
{
公共技能库查找()
{
this.UserSkills=new HashSet();
this.RequiredJobSkills=new HashSet();
}
公共int Id{get;set;}
公共字符串SkillName{get;set;}
公共字符串说明{get;set;}
公共ICollection用户技能{get;set;}
公共ICollection RequiredJobSkills{get;set;}
}

您在哪里注册实体/表之间的关系?我不熟悉这一点,我首先使用的是数据库,所以它可能不是最好的设计,这可能就是它出现问题的地方,RequiredJobSkill表通过RequiredJobSkill.JobId=Job.Id然后RequiredJobSkill.SkillId=SkillPool_Lookup.Id与Job表相关。我可以从RequireJobSkill表中获取所有信息,但不能获取SkillPool_查找中的相关数据。当我使用includes收集数据时,我可以获取(链接/桥接)表,但不能获取联接另一侧的关联数据。我相信我可能只需要修改Include,但不确定该往哪个方向走。这是我的简历。public void GetJob(){Using(Entities ctx=new Entities()){var mylist=ctx.Jobs.Where(x=>x.JobStatusId==1)。包括(x=>RequiredJobSkills)。ToList()}
public void GetJob(){Using(Entities ctx=new Entities()){var mylist=ctx.Jobs.Where(x=>x.JobStatusId==1)。包括(x=>x.RequiredJobSkills)。ToList()