注册

.net7 EFCore中执行异常Dm.DmException (0x80004005)

Viazy弦 2024/08/20 556 2

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:dm8_20240613_x86_rh6_64_rq_ent_8.1.3.140_pack5
【操作系统】:centOs Docker环境
【CPU】:
【问题描述】*:
Executing DbCommand [Parameters=[:__ef_filter__p_0='False', :__providerName_1='R' (Size = 1), :__providerKey_2='admin' (Size = 5)], CommandType='Text', CommandTimeout='30']

SELECT "a"."Id", "a"."Name", "a"."ProviderKey", "a"."ProviderName", "a"."TenantId"
FROM "AbpPermissionGrants" AS "a"
WHERE (:__ef_filter__p_0 OR ("a"."TenantId" IS NULL)) AND "a"."Name" IN ('………………') AND "a"."ProviderName" = :__providerName_1 AND "a"."ProviderKey" = :__providerKey_2

异常描述
An exception occurred while iterating over the results of a query for context type 'Volo.Abp.PermissionManagement.EntityFrameworkCore.PermissionManagementDbContext'.
Dm.DmException (0x80004005): 第3 行附近出现错误:
查询使用值表达式作为过滤条件
at Dm.DmCommand.do_ExecuteDbDataReader(CommandBehavior behavior)
at Dm.DmCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)

准确来说应该由于
if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)))
{
Expression<Func<TEntity, bool>> multiTenantFilter = e => !IsMultiTenantFilterEnabled || EF.Property<Guid>(e, "TenantId") == CurrentTenantId;
expression = expression == null ? multiTenantFilter : QueryFilterExpressionHelper.CombineExpressions(expression, multiTenantFilter);
}
该问题引起。

另外在使用EFTools 中执行 Update-Database 时,发生
Dm.DmException (0x80004005): 第19 行附近出现错误:
对象[IsDeleted]DEFAULT约束表达式无效
通过 Script-Migration 发现bool类型, 生成的脚本为
"IsDeleted" BIT DEFAULT FALSE NOT NULL
DEFAULT FALSE 默认值问题

回答 0
暂无回答
扫一扫
联系客服