I keep getting the following error:
Unable to evaluate expression. The operation is not supported. unknown error: 0x80070057
when trying to return the parent object and its children.
The database builds, seeds and has all the relationships defined correctly, as far as I can see. I built a smaller model just for testing and in order to show the problem:
Parent Object:
public class Person { [Key] [Column(Order = 1)] public int Id { get; set; } [StringLength(100)] public string Name { get; set; } public DateTime DateModified { get; set; } public DateTime DateCreated { get; set; } public virtual ICollection<Job> Jobs { get; set; } }
Children's object:
public class Job { [Key] [Column(Order = 1)] public int Id { get; set; } [StringLength(100)] public string Name { get; set; } public int PersonId { get; set; } [ForeignKey("PersonId")] public virtual Person Person { get; set; } }
return _context.Person works and returns a list of people with zero jobs
Returning _context.Person.Include(o => o.Jobs) causes the above error.
This, I know, is simple material and only two very simple tables, but I donβt see where the problem is, because I created this senario model countless times without problems. I am thinking about rebuilding the project and EF dependencies, but would prefer to understand this problem and fix it if possible.
source share