You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've been following https://learn.microsoft.com/en-us/ef/core/querying/filters to implement a global query filter to support our multi-tenancy setup. Our current 'hand-crafted' scoping only handles the main entity, and not any joined entities/sub-collections.
The current TenantId is passed down the data context via parameter, and then placed in the query filter like so:
All seemed fine however on inspecting the sql generated we noticed the value wasn't parameterised:
Is this a restriction on using the query filter or is it due do the TenantId being provided as a parameter and therefore not being class-level? Is there a possible workaround to avoid the need for generating separate query plans across tenants?
Thanks :)
Include provider and version information
EF Core version: 8.0.5
Database provider: Azure SQL Server
Target framework: .NET8
Operating system: Windows 11
IDE: Visual Studio 2022 17.9
The text was updated successfully, but these errors were encountered:
This issue is lacking enough information for us to be able to fully understand what is happening. Please attach a small, runnable project or post a small, runnable code listing that reproduces what you are seeing so that we can investigate.
Ask a question
We've been following https://learn.microsoft.com/en-us/ef/core/querying/filters to implement a global query filter to support our multi-tenancy setup. Our current 'hand-crafted' scoping only handles the main entity, and not any joined entities/sub-collections.
The current
TenantId
is passed down the data context via parameter, and then placed in the query filter like so:All seemed fine however on inspecting the sql generated we noticed the value wasn't parameterised:
Is this a restriction on using the query filter or is it due do the
TenantId
being provided as a parameter and therefore not being class-level? Is there a possible workaround to avoid the need for generating separate query plans across tenants?Thanks :)
Include provider and version information
EF Core version: 8.0.5
Database provider: Azure SQL Server
Target framework: .NET8
Operating system: Windows 11
IDE: Visual Studio 2022 17.9
The text was updated successfully, but these errors were encountered: