EF核心问题过滤相关实体

时间:2020-07-26 16:47:27

标签: c# entity-framework-core

我流淌:

public class Tasks{

    [Display(Name =nameof(Resources.Tasks.Task_Id), ResourceType = typeof(Resources.Tasks))]
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public Int64 Task_Id  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.Task_Name), ResourceType = typeof(Resources.Tasks))]
    public string Task_Name  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.Tasks_f), ResourceType = typeof(Resources.Tasks))]
    public string Tasks_f  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.Start_Date), ResourceType = typeof(Resources.Tasks))]
    [DisplayFormat(DataFormatString ="{0:dd/MM/yyyy}")]
    public DateTime? Start_Date  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.End_Date), ResourceType = typeof(Resources.Tasks))]
    [DisplayFormat(DataFormatString ="{0:dd/MM/yyyy}")]
    public DateTime? End_Date  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.CreatedBy), ResourceType = typeof(Resources.Tasks))]
     [ForeignKey("CreatedBy")]
    public Int64 CreatedBy  { get; set; } 
    [Display(Name =nameof(Resources.Tasks.Duration), ResourceType = typeof(Resources.Tasks))]
    public Int32? Duration  { get; set; }
    public bool Complete { get; set; }
   
    public bool Approved { get; set; }
        public bool Can_Change_DeadLine { get; set; }
        public bool skep_WeekEnd_And_Holldays { get; set; }
        public bool Approv_Task_When_Finish { get; set; }
        public bool Add_To_Faviort { get; set; }
        public bool Auto_Complet_Task_When_SubTask_Complet { get; set; }
        [ForeignKey("Task_Id")]
        public   Int64? SubTask_Of { get; set; }
        public List<Tasks> tasks_idList { get; set; }
        public List<Observers>  observerstask_idList  { get; set; } 
    public List<PersonInTask>  personintasktask_idList  { get; set; } 
    public List<ResponsibelInTask>  responsibelintasktask_idList  { get; set; } 
    public List<Task_Options>  task_optionstask_idList  { get; set; } 
    public Employee  employeecreatedby  { get; set; }
        public Tasks tasksSubTask_Of { get; set; }
    }

当我尝试完成列表和子列表巫师时:

 List<Tasks> taskList = new List<Tasks>();

 taskList = await dc.TasksDbSet.Include(d => d.tasks_idList
                                    .Select(t=>t.Complete==false))
                    .Where(t => t.Complete == false && t.Approved == false)
                    .Include(d => d.employeecreatedby)
                    .Skip(skip)
                    .Take(take)
                    .ToListAsync();

我得到了:

处理请求时发生未处理的异常。 InvalidOperationException:包含属性lambda表达式'd => {从d.tasks_idList中的任务t选择([t]。完成== False)}'无效。该表达式应表示属性访问:'t => t.MyProperty”。要定位在派生类型上声明的导航, 指定目标类型的显式输入的lambda参数,例如 '(派生d)=> d.MyProperty'。有关包括的更多信息

0 个答案:

没有答案