IdeaBlade.EntityModel.Server Assembly > IdeaBlade.EntityModel.Server Namespace : EntityServerQueryInterceptor Class |
'Declaration
<DefaultExportAttribute(IsDefault=True, ContractName="", ContractType=IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor)> Public Class EntityServerQueryInterceptor
'Usage
Dim instance As EntityServerQueryInterceptor
[DefaultExport(IsDefault=true, ContractName="", ContractType=IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor)] public class EntityServerQueryInterceptor
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.
// 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); } }
System.Object
IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2