From f4d38b9acded6c341f2c1910411c1fe645388fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 13 Jun 2023 18:30:09 +0300 Subject: [PATCH] Resolve #16809: Documentation should not encourage IQueryable usage in AppServices --- docs/en/Repositories.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index 23ed2371dd..fb6fd6eac6 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -140,9 +140,9 @@ public async Task> GetListAsync(string filter) Any standard LINQ method can be used over the `IQueryable` returned from the repository. -> This sample uses `ToList()` method, but it is **strongly suggested to use the asynchronous methods** to perform database queries, like `ToListAsync()` for this example. -> -> See the **IQueryable & Async Operations** section to learn how you can do it. +> This sample uses `ToList()` method, but it is **strongly suggested to use the asynchronous methods** to perform database queries, like `ToListAsync()` for this example. See the **`IQueryable` & Async Operations** section to learn how you can do it. + +> **Exposing `IQueryable` to outside of a repository** class may leak your data access logic to the application layer. If you want to strictly follow the **layered architecture** principles, you can consider to implement a **custom repository** class and wrap your data access logic inside your repository class. You can see [EF Core](Entity-Framework-Core.md) or [MongoDb](MongoDB.md) document to learn how to create custom repository classes for your application. ### Bulk Operations