Hi, After updating to V13, NotificationPublisher is generating the following error:
ERROR 2024-01-11 16:07:23,657 [orker] Mvc.ExceptionHandling.AbpExceptionFilter - Can not set TenantId to 0 for IMustHaveTenant entities!
Abp.AbpException: Can not set TenantId to 0 for IMustHaveTenant entities!
at Abp.EntityFrameworkCore.AbpDbContext.CheckAndSetMustHaveTenantIdProperty(Object entityAsObj)
at Abp.EntityFrameworkCore.AbpDbContext.ApplyAbpConceptsForAddedEntity(EntityEntry entry, Nullable1 userId, EntityChangeReport changeReport) at Abp.EntityFrameworkCore.AbpDbContext.ApplyAbpConcepts(EntityEntry entry, Nullable
1 userId, EntityChangeReport changeReport)
at Abp.EntityFrameworkCore.AbpDbContext.ApplyAbpConcepts()
at Abp.EntityFrameworkCore.AbpDbContext.SaveChangesAsync(CancellationToken cancellationToken)
at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext3.SaveChangesAsync(CancellationToken cancellationToken) at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.SaveChangesAsync() at Abp.Notifications.NotificationStore.<>c__DisplayClass14_0.<<InsertNotificationAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at Abp.Domain.Uow.UnitOfWorkManagerExtensions.WithUnitOfWorkAsync(IUnitOfWorkManager manager, Func
1 action, UnitOfWorkOptions options)
at Abp.Notifications.NotificationStore.InsertNotificationAsync(NotificationInfo notification)
at Abp.Notifications.NotificationPublisher.PublishAsync(String notificationName, NotificationData data, EntityIdentifier entityIdentifier, NotificationSeverity severity, UserIdentifier[] userIds, UserIdentifier[] excludedUserIds, Nullable`1[] tenantIds, Type[] targetNotifiers)
my code
public async Task SendSolicitacaoColaboradorMessageAsync(UserIdentifier user, string message, NotificationSeverity severidade) { await _notificationPublisher.PublishAsync(AppNotificationNames.SolicitacoesColaborador, new MessageNotificationData(message), severity: severidade, userIds: new[] { user } ); }
await _appNotifier.SendSolicitacaoColaboradorMessageAsync(new UserIdentifier((int)AbpSession.TenantId, userId), $"mesage {Solicitacao.DataInicial}", Abp.Notifications.NotificationSeverity.Success);
3 Answer(s)
-
0
Hi,
Have you modified NotificationStore ?
-
0
Hi,
No.
-
0
Hi @ricardo
Somehow, we don't get this error on non-modified project. Is it possible for you to share your project or a reproduction project via email with [email protected] ?