-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Hi @NickCc6, I can't reproduce this. With your exact The Could you share a minimal repro project (a single |
Beta Was this translation helpful? Give feedback.
-
|
Hi @NickCc6, I've reproduced this on your repro and pushed a fix in #25570 — it'll ship in the next release. Root cause: the soft-delete DbFunction translator hardcodes the Until the fix is released, you can re-register the DbFunction in your own using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Query.SqlExpressions;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.GlobalFilters;
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ApplyConfigurationsFromAssembly(typeof(PostgreSqlDbContext).Assembly);
base.OnModelCreating(modelBuilder);
// Workaround for abpframework/abp#25570 until released
var ctx = this.GetInfrastructure().GetService<AbpEfCoreCurrentDbContext>();
modelBuilder.HasDbFunction(AbpEfCoreDataFilterDbFunctionMethods.SoftDeleteFilterMethodInfo)
.HasTranslation(args =>
{
var isDeleted = args[0];
var boolParam = args[1];
if (ctx.Context?.DataFilter.IsEnabled<ISoftDelete>() == true)
{
return new SqlBinaryExpression(
ExpressionType.Equal,
isDeleted,
new SqlConstantExpression(false, typeof(bool), isDeleted.TypeMapping ?? boolParam.TypeMapping),
boolParam.Type,
boolParam.TypeMapping);
}
return new SqlConstantExpression(true, typeof(bool), boolParam.TypeMapping);
});
}Tested on your repro with ABP 10.4.1 + Npgsql 9 — output becomes Alternatively, if you can change the database schema, dropping |
Beta Was this translation helpful? Give feedback.


Hi @NickCc6, I've reproduced this on your repro and pushed a fix in #25570 — it'll ship in the next release. Root cause: the soft-delete DbFunction translator hardcodes the
falseliteral with the bool TypeMapping, ignoring yourHasConversion<int>(), so PostgreSQL emitsis_deleted = FALSEagainst an int column.Until the fix is released, you can re-register the DbFunction in your own
OnModelCreatingwith the fixed translation — no need to disableUseDbFunction: