using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace FM.Test.Blazor;
public class AbpMultiTenantHubFilter : IHubFilter
{
public virtual async ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
{
var currentPrincipalAccessor = invocationContext.ServiceProvider.GetRequiredService<ICurrentPrincipalAccessor>();
using (currentPrincipalAccessor.Change(invocationContext.Context.User))
{
var tenantId = currentPrincipalAccessor.Principal.FindTenantId();
string tenantName = null;
if (tenantId != null)
{
tenantName = (await invocationContext.ServiceProvider.GetRequiredService<ITenantStore>().FindAsync(tenantId.Value))?.Name;
}
using (invocationContext.ServiceProvider.GetRequiredService<ICurrentTenant>().Change(currentPrincipalAccessor.Principal.FindTenantId(), tenantName))
{
return await next(invocationContext);
}
}
}
public virtual Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
{
return Task.CompletedTask;
}
public virtual Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
{
return Task.CompletedTask;
}
}
hi
Can you test the UseNetTopologySuite
in a new template project.
and share it with me. liming.ma@volosoft.com
hi
You can create a simple ef core project to test.
It seems related to https://github.com/npgsql/npgsql/
hi
Please test below code.
context.Services.AddSignalR(options =>
{
options.AddFilter<AbpMultiTenantHubFilter>();
}).AddAzureSignalR();
using System;
using System.Security.Principal;
using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace FM.Test.Blazor;
public class AbpMultiTenantHubFilter : IHubFilter
{
public virtual async ValueTask<object> InvokeMethodAsync(HubInvocationContext invocationContext, Func<HubInvocationContext, ValueTask<object>> next)
{
var currentPrincipalAccessor = invocationContext.ServiceProvider.GetRequiredService<ICurrentPrincipalAccessor>();
using (currentPrincipalAccessor.Change(invocationContext.Context.User))
{
using (invocationContext.ServiceProvider.GetRequiredService<ICurrentTenant>().Change(currentPrincipalAccessor.Principal.FindTenantId()))
{
return await next(invocationContext);
}
}
}
public virtual Task OnConnectedAsync(HubLifetimeContext context, Func<HubLifetimeContext, Task> next)
{
return Task.CompletedTask;
}
public virtual Task OnDisconnectedAsync(HubLifetimeContext context, Exception exception, Func<HubLifetimeContext, Exception, Task> next)
{
return Task.CompletedTask;
}
}
hi
I suggest you use EF's way of implementing it instead of Object Extensions
. It's not designed for this.
The suite may not support some special cases. You have to do it manually.
hi
What's your external Oauth (OpenId ) provider
?
Generally you need to override the OnGetExternalLoginCallbackAsync
of LoginModel
hi
There seems the ChatConversations
table has some wrong records.
How can I reproduce this? Is there any steps?
hi
Can I reproduce this in a new template project?
You can also try to clear the Reids.
I switched to True in database and tried to refresh the cache but that did not fix the issue.
hi
Please share the settings table records.
liming.ma@volosoft.com