-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repository.Find(id) and Incldude() #20
Comments
@SuddenGunter In this case, you should inject var cityRepo = uow.GetRepository<City>();
var city = cityRepo.Find(5);
uow.DbContext.Entry(city).Reference(c => c.Country).Load();
var countryRepo = uow.GetRepository<Country>();
var country = countryRepo.Find(city.CountryId);
uow.DbContext.Entry(country).Collection(c => c.Cities).Load(); |
Thank you, for the answer and for the project |
The problem with IUnitOfWork<> is that the Customer service need to know the real class behind DBContext (or I don't understand a point). Wouldn't it be better to enrich the repository with a method like this: `public async Task FindAsync(
|
Good idea, could you PR for this? Add some unit test. |
I think there is a caveat because one may use Reference or Collection as well. |
How to get an entity by Id and load navigation properties values?
Only using GetPagedList?
The text was updated successfully, but these errors were encountered: