{"record":{"id":"13a7a71f35c29dc9","repo":"aspnetboilerplate/aspnetboilerplate","slug":"your-ef-core-database-provider-does-not-support-u","errorCode":null,"errorMessage":"Your EF Core database provider does not support 'User-defined function mapping'.Please set 'UseAbpQueryCompiler' of 'IAbpEfCoreConfiguration' to false to disable it.See https://learn.microsoft.com/en-us/ef/core/querying/user-defined-function-mapping for more information.","messagePattern":"Your EF Core database provider does not support 'User-defined function mapping'\\.Please set 'UseAbpQueryCompiler' of 'IAbpEfCoreConfiguration' to false to disable it\\.See https://learn\\.microsoft\\.com/en-us/ef/core/querying/user-defined-function-mapping for more information\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/Abp.EntityFrameworkCore/EntityFrameworkCore/AbpDbContext.cs","lineNumber":232,"sourceCode":"    }\n\n    protected virtual bool UseAbpQueryCompiler()\n    {\n        return DbContextOptions?.FindExtension<AbpDbContextOptionsExtension>() != null && AbpEfCoreConfiguration.UseAbpQueryCompiler;\n    }\n\n    public virtual string GetCompiledQueryCacheKey()\n    {\n        return $\"{CurrentTenantId?.ToString() ?? \"Null\"}:{IsSoftDeleteFilterEnabled}:{IsMayHaveTenantFilterEnabled}:{IsMustHaveTenantFilterEnabled}\";\n    }\n\n    protected const string DbFunctionNotSupportedExceptionMessage = \"Your EF Core database provider does not support 'User-defined function mapping'.\" +\n                                                        \"Please set 'UseAbpQueryCompiler' of 'IAbpEfCoreConfiguration' to false to disable it.\" +\n                                                        \"See https://learn.microsoft.com/en-us/ef/core/querying/user-defined-function-mapping for more information.\";\n\n    public static bool SoftDeleteFilter(bool isDeleted, bool boolParam)\n    {\n        throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);\n    }\n\n    public static bool MustHaveTenantFilter(int tenantId, int? currentTenantId, bool boolParam)\n    {\n        throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);\n    }\n\n    public static bool MayHaveTenantFilter(int? tenantId, int? currentTenantId, bool boolParam)\n    {\n        throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);\n    }\n\n    protected void ConfigureGlobalValueConverter<TEntity>(ModelBuilder modelBuilder, IMutableEntityType entityType)\n        where TEntity : class\n    {\n        if (entityType.BaseType == null &&\n            !typeof(TEntity).IsDefined(typeof(DisableDateTimeNormalizationAttribute), true) &&\n            !typeof(TEntity).IsDefined(typeof(OwnedAttribute), true) &&","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/aspnetboilerplate/aspnetboilerplate/blob/2323c13a152aa0ebfb37af3830f687d7f5b53795/src/Abp.EntityFrameworkCore/EntityFrameworkCore/AbpDbContext.cs#L214-L250","documentation":"SoftDeleteFilter is a static stub mapped as a database function (DbFunction) for ABP's soft-delete global query filter. When the EF Core provider cannot translate user-defined function mapping, EF invokes the .NET stub at query time, which throws this NotSupportedException. It exists to direct developers to disable ABP's custom query compiler, which injects the function-based filter translation.","triggerScenarios":"Querying entities implementing ISoftDelete with UseAbpQueryCompiler enabled (default) while the database provider lacks user-defined function mapping support (e.g. certain older/limited EF Core providers).","commonSituations":"Using a third-party or older EF Core provider (e.g. some SQLite/InMemory versions, or custom providers) that doesn't support HasDbFunction mapping; upgrading EF Core where provider support regressed; binding custom SQL functions on providers without function-mapping support.","solutions":["Disable ABP's function-based filtering: configure AbpEfCoreConfiguration.UseAbpQueryCompiler = false in the DbContext PreInitialize/configuration","Upgrade the EF Core database provider to a version supporting user-defined function mapping","If using InMemory provider for tests, switch to the SQLite in-memory provider or disable UseAbpQueryCompiler"],"exampleFix":"// before\nConfiguration.Modules.AbpEfCore().AddAbpDbContextOptions(...); // default query compiler\n// after\nConfiguration.Modules.AbpEfCore().UseAbpQueryCompiler = false;\n// or in DbContextOptions configuration\nConfigure<AbpEfCoreConfiguration>(c => c.UseAbpQueryCompiler = false);","handlingStrategy":"fallback","validationCode":"// fail fast before querying ISoftDelete entities\nvar providerName = dbContext.Database.ProviderName;\nvar unsupported = providerName == \"Microsoft.EntityFrameworkCore.InMemory\";\nif (unsupported)\n{\n    // disable ABP query compiler in configuration instead\n    Configure<AbpEfCoreConfiguration>(c => c.UseAbpQueryCompiler = false);\n}","typeGuard":"bool softDeleteFilterSafe =\n    dbContext.Model.GetEntityTypes().All(e => !typeof(ISoftDelete).IsAssignableFrom(e.ClrType))\n    || Configuration.Modules.AbpEfCore().UseAbpQueryCompiler == false;","tryCatchPattern":"try\n{\n    var list = await _repository.GetAllListAsync(x => !x.IsDeleted);\n}\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"User-defined function mapping\"))\n{\n    // reconfigure with UseAbpQueryCompiler = false and restart, or use a provider that supports DbFunction mapping\n}","preventionTips":["Set UseAbpQueryCompiler = false when targeting providers without function-mapping support (InMemory, some SQLite/3rd-party providers)","Use SQLite (in-memory) instead of InMemory provider for tests with ABP filters","Pin EF Core and provider versions compatible with user-defined function mapping","Document provider requirements when enabling ABP query filters"],"tags":["efcore","abp","query-filter","unsupported-provider"],"backgroundTag":"unsupported-operation","analyzedSha":"2323c13a152aa0ebfb37af3830f687d7f5b53795","analyzedAt":"2026-09-08T08:00:50.638Z","contentChangedAt":"2026-09-08T08:00:50.638Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}