aspnetboilerplate/aspnetboilerplate · error · NotSupportedException
Your EF Core database provider does not support…
Error message
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.
What it means
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.
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
Example fix
// before Configuration.Modules.AbpEfCore().AddAbpDbContextOptions(...); // default query compiler // after Configuration.Modules.AbpEfCore().UseAbpQueryCompiler = false; // or in DbContextOptions configuration Configure<AbpEfCoreConfiguration>(c => c.UseAbpQueryCompiler = false);
Defensive patterns
Strategy: fallback
Validate before calling
// fail fast before querying ISoftDelete entities
var providerName = dbContext.Database.ProviderName;
var unsupported = providerName == "Microsoft.EntityFrameworkCore.InMemory";
if (unsupported)
{
// disable ABP query compiler in configuration instead
Configure<AbpEfCoreConfiguration>(c => c.UseAbpQueryCompiler = false);
} Type guard
bool softDeleteFilterSafe =
dbContext.Model.GetEntityTypes().All(e => !typeof(ISoftDelete).IsAssignableFrom(e.ClrType))
|| Configuration.Modules.AbpEfCore().UseAbpQueryCompiler == false; Try / catch
try
{
var list = await _repository.GetAllListAsync(x => !x.IsDeleted);
}
catch (NotSupportedException ex) when (ex.Message.Contains("User-defined function mapping"))
{
// reconfigure with UseAbpQueryCompiler = false and restart, or use a provider that supports DbFunction mapping
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- ex.Message (wraps DbUpdateConcurrencyException)
- A dictionary can not contain same key twice. There are some…
- A dictionary can not contain same key twice. There are some…
- A Localization Xml must include localizationDictionary as…
- abp.ui.clearBusy is not implemented!
AI-assisted analysis of aspnetboilerplate/aspnetboilerplate@2323c13a15 (2026-09-08).
Data as JSON: /api/errors/13a7a71f35c29dc9.
Report an issue: GitHub.
Appendix: source
Thrown at src/Abp.EntityFrameworkCore/EntityFrameworkCore/AbpDbContext.cs:232
}
protected virtual bool UseAbpQueryCompiler()
{
return DbContextOptions?.FindExtension<AbpDbContextOptionsExtension>() != null && AbpEfCoreConfiguration.UseAbpQueryCompiler;
}
public virtual string GetCompiledQueryCacheKey()
{
return $"{CurrentTenantId?.ToString() ?? "Null"}:{IsSoftDeleteFilterEnabled}:{IsMayHaveTenantFilterEnabled}:{IsMustHaveTenantFilterEnabled}";
}
protected const string DbFunctionNotSupportedExceptionMessage = "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.";
public static bool SoftDeleteFilter(bool isDeleted, bool boolParam)
{
throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);
}
public static bool MustHaveTenantFilter(int tenantId, int? currentTenantId, bool boolParam)
{
throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);
}
public static bool MayHaveTenantFilter(int? tenantId, int? currentTenantId, bool boolParam)
{
throw new NotSupportedException(DbFunctionNotSupportedExceptionMessage);
}
protected void ConfigureGlobalValueConverter<TEntity>(ModelBuilder modelBuilder, IMutableEntityType entityType)
where TEntity : class
{
if (entityType.BaseType == null &&
!typeof(TEntity).IsDefined(typeof(DisableDateTimeNormalizationAttribute), true) &&
!typeof(TEntity).IsDefined(typeof(OwnedAttribute), true) &&View on GitHub (pinned to 2323c13a15)