0

I have a Generic Repository which has all the common operations. I have two tables Customer and Address. Address is referenced in Customer

public IEnumerable<TEntity> GetAll() { return context.Set<TEntity>(); } 

Below is my repository

Repository<Customer> customerRepostitory = new Repository<Customer>(); var cusotomerList = customerRepostitory.GetAll(); 

The above line just returning the customer list, its not including Address Details. Can you suggest the best way to retrieve the child records when i call parent records.

2
  • can we see the Customer type declaration ? (probalby a virtual missing below the adresses) Commented Apr 2, 2013 at 17:08
  • Perfect.. Virtual is missing. Thank you. I don't know how to mark your comment as answer. Commented Apr 2, 2013 at 17:24

1 Answer 1

1

If it was the virtual, you just discover lazy loading, one of the way to handle child records. You should read about the other ways/strategiess : eager loading and explicit loading to discover which one is/are the best for your cases.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.