Base solution for your next web application
Open Closed

AbpQueryCompiler #12425


User avatar
0
ricardo created

Hi,

I was checking the documentation https://aspnetboilerplate.com/Pages/Documents/Articles%5CHow-To%5Cadd-custom-data-filter-ef-core . The documentation refers to Using User-defined function mapping for global filters. But I didn't identify where I can enable the use by UseAbpQueryCompiler. What is the correct way to use AbpQueryCompiler, and if there is anything else I need to know to implement it.

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

3 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    To enable UseAbpQueryCompiler, navigate to the YourProjectNameEntityFrameworkCoreModule module and activate it within the PreInitialize method as shown below. By default, it is set to false.

    public override void PreInitialize()
    {
        Configuration.Modules.AbpEfCore().UseAbpQueryCompiler = true;
    }
    

    The UseAbpQueryCompiler method is inherited from the AbpZeroDbContext class. You can use this method within your YourProjectNameDbContext class according to your scenario to apply filtering operations.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    ricardo created

    HI

    Thanks for the quick response. When I enable the option Configuration.Modules.AbpEfCore().UseAbpQueryCompiler = true; I get the error below:

    Abp.AbpException: No language defined! at Abp.Localization.MultiTenantLocalizationDictionaryProvider.GetDefaultDictionary() at Abp.Localization.MultiTenantLocalizationDictionaryProvider.get_DefaultDictionary() at Abp.Localization.Dictionaries.DictionaryBasedLocalizationSource.GetAllStrings(CultureInfo culture, Boolean includeDefaults) at Abp.Web.Localization.LocalizationScriptManager.BuildAll(CultureInfo cultureInfo) at Abp.Web.Localization.LocalizationScriptManager.GetScript(CultureInfo cultureInfo) at Abp.Web.Localization.LocalizationScriptManager.GetScript() at Abp.AspNetCore.Mvc.Controllers.AbpScriptsController.GetScripts(String culture, Boolean minify) at lambda_method1310(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeNextResourceFilter() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|7_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Abp.AspNetZeroCore.Web.Authentication.JwtBearer.JwtTokenMiddleware.<>c__DisplayClass0_0.vPKn7WALnYlTAKFA1Te.MoveNext() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @ricardo

    Thank you for your feedback. We have created an issue regarding this matter. You can follow the progress from here. Have a great day.

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)