Thanks. We will check it.
And can you try to add MyAbpEfCoreNavigationHelper to your EF Core project.
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EntityFrameworkCore.ChangeTrackers;
using Volo.Abp.OpenIddict.Tokens;
namespace Pusula.Training.HealthCare.EntityFrameworkCore;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(AbpEfCoreNavigationHelper))]
public class MyAbpEfCoreNavigationHelper : AbpEfCoreNavigationHelper
{
public override void ChangeTracker_Tracked(object? sender, EntityTrackedEventArgs e)
{
if (e.Entry.Entity.GetType() == typeof(OpenIddictToken))
{
return;
}
base.ChangeTracker_Tracked(sender, e);
}
public override void ChangeTracker_StateChanged(object? sender, EntityStateChangedEventArgs e)
{
if (e.Entry.Entity.GetType() == typeof(OpenIddictToken))
{
return;
}
base.ChangeTracker_StateChanged(sender, e);
}
}
hi
We will support this case by https://github.com/abpframework/abp/pull/22632
You can add MyEditionFeatureValueProvider to fix it now.
public class FeatureTestDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
//...
PostConfigure<AbpFeatureOptions>(options =>
{
options.ValueProviders.InsertAfter(r => r == typeof(EditionFeatureValueProvider),
typeof(MyEditionFeatureValueProvider)
);
options.ValueProviders.Remove<EditionFeatureValueProvider>();
});
//...
}
}
using System.Security.Principal;
using System.Threading.Tasks;
using Volo.Abp.Features;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
using Volo.Saas.Tenants;
namespace FeatureTest;
public class MyEditionFeatureValueProvider : FeatureValueProvider
{
public const string ProviderName = "E";
public override string Name => ProviderName;
protected ICurrentPrincipalAccessor PrincipalAccessor;
protected ITenantRepository TenantRepository;
protected ICurrentTenant CurrentTenant { get; }
public MyEditionFeatureValueProvider(IFeatureStore featureStore, ICurrentPrincipalAccessor principalAccessor, ITenantRepository tenantRepository, ICurrentTenant currentTenant)
: base(featureStore)
{
PrincipalAccessor = principalAccessor;
TenantRepository = tenantRepository;
CurrentTenant = currentTenant;
}
public override async Task<string?> GetOrNullAsync(FeatureDefinition feature)
{
var editionId = PrincipalAccessor.Principal?.FindEditionId();
if (editionId == null)
{
if (!CurrentTenant.Id.HasValue)
{
return null;
}
var tenant = await TenantRepository.FindByIdAsync(CurrentTenant.Id.Value);
if (tenant == null || !tenant.EditionId.HasValue)
{
return null;
}
editionId = tenant.EditionId;
}
return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString());
}
}
hi
Can you share your project source code?
I will download and check the code.
You can remove the environment code so I can reproduce it on my local.
liming.ma@volosoft.com
Thanks.
190 permission should be pretty quick. I think the issue still has to do with Redis.
You can try to disable the cache in PermissionStore?
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories;
namespace Volo.Abp.PermissionManagement;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IPermissionStore), typeof(PermissionStore), typeof(MyPermissionStore))]
public class MyPermissionStore : PermissionStore
{
public MyPermissionStore(
IPermissionGrantRepository permissionGrantRepository,
IDistributedCache<PermissionGrantCacheItem> cache,
IPermissionDefinitionManager permissionDefinitionManager)
: base(permissionGrantRepository, cache, permissionDefinitionManager)
{
}
public async override Task<bool> IsGrantedAsync(string name, string providerName, string providerKey)
{
using (PermissionGrantRepository.DisableTracking())
{
var permissionGrant = await PermissionGrantRepository.FindAsync(name, providerName, providerKey);
return permissionGrant != null;
}
}
public async override Task<MultiplePermissionGrantResult> IsGrantedAsync(string[] names, string providerName, string providerKey)
{
Check.NotNullOrEmpty(names, nameof(names));
var result = new MultiplePermissionGrantResult();
if (names.Length == 1)
{
var name = names.First();
result.Result.Add(name, await IsGrantedAsync(names.First(), providerName, providerKey)
? PermissionGrantResult.Granted
: PermissionGrantResult.Undefined);
return result;
}
using (PermissionGrantRepository.DisableTracking())
{
var permissionGrants = await PermissionGrantRepository.GetListAsync(names, providerName, providerKey);
foreach (var name in names)
{
result.Result.Add(name,
permissionGrants.Any(x => x.Name == name)
? PermissionGrantResult.Granted
: PermissionGrantResult.Undefined);
}
return result;
}
}
}
I don't have many ideas.
I ran your project, and it works.
https://abp.io/support/questions/9350/Custom-ConnectionStringResolver-Issue#answer-3a1a07c1-789d-d7e0-e1c2-2bab8465974e
You're welcome.
好的, 支持团队会检查 9371 问题。
hi
It will be the same as NET 9, We will test NET 10 RC in August or September. And will upgrade to the official version as soon as possible, then release ABP 10.0.
https://github.com/abpframework/abp/issues/20561