diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index de26b7c3f0..568623a15d 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -607,18 +607,6 @@ Whenever you access to a property/collection, EF Core automatically performs an See also [lazy loading document](https://docs.microsoft.com/en-us/ef/core/querying/related-data/lazy) of the EF Core. -## Repository Extensions - -There are some useful repository extension methods. - -````csharp -EnsureCollectionLoadedAsync // **Explicitly load** a sub collection. -EnsurePropertyLoadedAsync // **Explicitly load** a navigation property. -EnsureExistsAsync // Make sure the entitys exists, It accepts the entity id or a query expression. -HardDeleteAsync // Hard delete the entitys, It accepts one or more entities or query expressions. -HardDeleteWithUnitOfWorkAsync // Hard delete the entitys in a uow(create a new uow if current is null), It accepts one or more entities or query expressions. -```` - ## Access to the EF Core API In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository pattern). However, if you want to access the `DbContext` instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example: diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index dc82876efb..a1a5ac5cce 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -164,6 +164,10 @@ If your entity is a soft-delete entity, you can use the `HardDeleteAsync` method > See the [Data Filtering](Data-Filtering.md) documentation for more about soft-delete. +### Ensure Entities Exists + +The `EnsureExistsAsync` extension method accepts entity id or entities query expression to ensure entities exist, otherwise, it will throw `EntityNotFoundException`. + ## Other Generic Repository Types Standard `IRepository` interface exposes the standard `IQueryable` and you can freely query using the standard LINQ methods. This is fine for most of the applications. However, some ORM providers or database systems may not support standard `IQueryable` interface. If you want to use such providers, you can't rely on the `IQueryable`.