Skip to content

Commit 27873fb

Browse files
authored
Update multitenancy.md (#4994)
Update range / line number to include for type `ContactContext` & overridden method `OnModelCreating` to show relevant implementation.
1 parent d723b3d commit 27873fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

entity-framework/core/miscellaneous/multitenancy.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ A possible solution is to create a simple `ITenantService` service that handles
4848

4949
The `DbContext` can then manage the multi-tenancy. The approach depends on your database strategy. If you are storing all tenants in a single database, you are likely going to use a query filter. The `ITenantService` is passed to the constructor via dependency injection and used to resolve and store the tenant identifier.
5050

51-
:::code language="csharp" source="../../../samples/core/Miscellaneous/Multitenancy/SingleDbSingleTable/Data/ContactContext.cs" range="10-13":::
51+
:::code language="csharp" source="../../../samples/core/Miscellaneous/Multitenancy/SingleDbSingleTable/Data/ContactContext.cs" range="11-14":::
5252

5353
The `OnModelCreating` method is overridden to specify the query filter:
5454

55-
:::code language="csharp" source="../../../samples/core/Miscellaneous/Multitenancy/SingleDbSingleTable/Data/ContactContext.cs" range="31-33":::
55+
:::code language="csharp" source="../../../samples/core/Miscellaneous/Multitenancy/SingleDbSingleTable/Data/ContactContext.cs" range="32-34":::
5656

5757
This ensures that every query is filtered to the tenant on every request. There is no need to filter in application code because the global filter will be automatically applied.
5858

0 commit comments

Comments
 (0)