Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

391
Views
DBContext does not contain a definition for Entry: Cannot load related data

When trying to load related data and following the guide on Explicit Loading of Related Data, I get the following error:

IApplicationDbcontext does not contain a definition for Entry.

My example code, similar to theirs, includes:

var person = _context.Persons.Single(p => p.PersonId = id);
_context.Entry(person).Collection(p => p.Addresses).Load();

The difference in my case is that I am injecting an IApplicationDbContext which looks pretty standard and I assume doesn't make a difference:

public class ApplicationDbContext : DbContext, IApplicationDbContext
{
   ...
   public DbSet<Person> Persons { get; set; }
   public DbSet<Address> Addresses { get; set; }
   ...
}

I have Microsoft.EntityFrameworkCore 5.0.7 within this project.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Your IApplicationDbContext must declare the following method signiture in it in order to work.

EntityEntry<TEntity> Entry<TEntity>([NotNullAttribute] TEntity entity) where TEntity : class;
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!