
Visual Basic (Declaration) | |
---|---|
<DefaultExportAttribute(IsDefault=True, ContractName="", ContractType=IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor)> Public Class EntityServerQueryInterceptor |
Visual Basic (Usage) | ![]() |
---|---|
Dim instance As EntityServerQueryInterceptor |
C# | |
---|---|
[DefaultExportAttribute(IsDefault=true, ContractName="", ContractType=IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor)] public class EntityServerQueryInterceptor |
C++/CLI | |
---|---|
[DefaultExportAttribute(IsDefault=true, ContractName="", ContractType=IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor)] public ref class EntityServerQueryInterceptor |
C# | ![]() |
---|---|
// Server-side implementation of EntityServerQueryInterceptor public class EntityServerQueryManager : EntityServerQueryInterceptor { // Always require explicit authorization attributes on entities. protected override bool DefaultAuthorization { get { return false; } } protected override bool FilterQuery() // Add filters - let's restrict everything to UK. QueryFilters.AddFilter<Customer>(q => q.Where(c => c.Country == "UK")); QueryFilters.AddFilter<Employee>(q => q.Where(e => e.Country == "UK")); return true; } // Log errors to any listening loggers. protected override void OnError(Exception e, PersistenceFailure failureType) { TraceFns.WriteLine("Query error: " + e.Message); } } |
You may intercept and customize query processing at several points during the query lifecycle. The query is first authorized before any further actions are taken: see DefaultAuthorization, AuthorizeQuery and ClientCanQuery for information. Next the query can be filtered to modify the query to be executed: see FilterQuery and QueryFilters for more information. Next the query is executed: see ExecuteQuery. Finally the query results can be authorized: see ShouldAuthorizeQueryResult and AuthorizeQueryResult. Query processing can be cancelled at any point in the lifecycle.
At all times during the lifecycle you have access to the Query and the Principal for the user issuing the query.
A new instance of your EntityServerQueryInterceptor is created for each query request.
System.Object
IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family