Starts in:
0 DAY
2 HRS
9 MIN
45 SEC
Starts in:
0 D
2 H
9 M
45 S
Open Closed

ValueFactory attempted to access the Value property of this instance #1377


User avatar
0
lalitChougule created
  • ABP Framework version: v3.0.4
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no / yes
  • Exception message and stack trace:
2021-05-14 14:14:46.482 +05:30 [ERR] One or more errors occurred. (ValueFactory attempted to access the Value property of this instance.)
System.AggregateException: One or more errors occurred. (ValueFactory attempted to access the Value property of this instance.)
 ---> System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetOrNull(String name)
   at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPolicyAsync(String policyName)
   at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider policyProvider, IEnumerable`1 authorizeData)
   at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
   at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at SCV.Litmus.Permissions.AccessPermissionDefinitionProvider.GetRoles() in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\AccessPermissionDefinitionProvider.cs:line 35
   at SCV.Litmus.Permissions.AccessPermissionDefinitionProvider.Define(IPermissionDefinitionContext context) in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\AccessPermissionDefinitionProvider.cs:line 25
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionGroupDefinitions()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionDefinitions()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
   at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetPermissions()
   at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPoliciesNamesAsync()
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAuthConfigAsync()
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAsync()
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync()
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeNextActionFilterAsync&gt;g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.&lt;InvokeNextExceptionFilterAsync&gt;g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
  • Steps to reproduce the issue: As below

I was trying to get dynamic value in PermissionDefinitionProvider below is the source code :

public class AccessPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        private readonly ISomeAppService _someAppService;

        public AccessPermissionDefinitionProvider(ISomeAppService someAppService)
        {
            _someAppService = someAppService;
        }
        
        public override void Define(IPermissionDefinitionContext context)
        {
            var myGroup = context.AddGroup("XYZAccessControl", L("Permission:XYZAccessControl"));
            var somePermission = myGroup.AddPermission("XYZBased", L("Permission:XYZ"));
            var fetchedData = GetData();
            foreach (var item in fetchedData)
            {
                somePermission.AddChild(item);
            }

        }

        private string[] GetData()
        {
            var data = _someAppService.GetSomeData().Result; //Just because await throws error here.
            return data.select(x=> x.someValue).Distinct().ToArray();
        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create&lt;XYZResource&gt;(name);
        }
    }

I cannot run the project as the above error is shown.

REQUIREMENT :

  1. I want to show dyanmic created values in PermissionManagement screen which are created on the go.I cannot explain the whole use case here but assume that these selected permission are to be used only and only at backend.
  2. While I tried returning GetData() with hardcode value it work's as per my expectation but the count is not increased/decreased once I select the permission from the permission tree. Not able to find how it works.

Please provide correct approach to achieve this, If I am doing it in a wrong way. I need to achieve this as this is the mandatory requirement for my project.


10 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The application service will try to get all permissions when you call the its method, even if the above error does not occur, it will be an infinite loop.

    I guess the GetSomeData method is async. The Define method of PermissionDefinitionProvider is sync. So there is async over sync problem.

    You can get dynamic permissions through other ways. Sync methods are preferred.

    Or call async method by AsyncHelper

    var resutl = AsyncHelper.RunSync(() => serviceProvider.GetRequiredService<ISchedulerFactory>().GetScheduler())

  • User Avatar
    0
    lalitChougule created

    Hi @maliming

    Error Log :

    2021-05-27 11:18:46.476 +05:30 [ERR] ValueFactory attempted to access the Value property of this instance.
    System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.
       at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
       at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
       at System.Lazy`1.CreateValue()
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetOrNull(String name)
       at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPolicyAsync(String policyName)
       at Microsoft.AspNetCore.Authorization.AuthorizationPolicy.CombineAsync(IAuthorizationPolicyProvider policyProvider, IEnumerable`1 authorizeData)
       at Volo.Abp.Authorization.MethodInvocationAuthorizationService.CheckAsync(MethodInvocationAuthorizationContext context)
       at Volo.Abp.Authorization.AuthorizationInterceptor.AuthorizeAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Authorization.AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
       at Nito.AsyncEx.AsyncContext.<>c__DisplayClass16_0`1.&lt;Run&gt;b__0(Task`1 t)
       at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
    --- End of stack trace from previous location where exception was thrown ---
       at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
    --- End of stack trace from previous location where exception was thrown ---
       at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task`1 task)
       at Nito.AsyncEx.AsyncContext.Run[TResult](Func`1 action)
       at Volo.Abp.Threading.AsyncHelper.RunSync[TResult](Func`1 func)
       at SCV.Litmus.Permissions.LitmusPermissionDefinitionProvider.GetRoles() in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\LitmusPermissionDefinitionProvider.cs:line 64
       at SCV.Litmus.Permissions.LitmusPermissionDefinitionProvider.Define(IPermissionDefinitionContext context) in D:\Litmus\Projects\core-platform\SCV.Litmus\aspnet-core\modules\litmus-core\src\SCV.Litmus.Application.Contracts\Permissions\LitmusPermissionDefinitionProvider.cs:line 57
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionGroupDefinitions()
       at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
       at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
       at System.Lazy`1.CreateValue()
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.CreatePermissionDefinitions()
       at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
       at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
       at System.Lazy`1.CreateValue()
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.get_PermissionDefinitions()
       at Volo.Abp.Authorization.Permissions.PermissionDefinitionManager.GetPermissions()
       at Volo.Abp.Authorization.AbpAuthorizationPolicyProvider.GetPoliciesNamesAsync()
       at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAuthConfigAsync()
       at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationAppService.GetAsync()
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
       at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
       at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
       at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
       at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.AbpApplicationConfigurationController.GetAsync()
       at lambda_method(Closure , Object )
       at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;InvokeActionMethodAsync&gt;g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
    --- End of stack trace from previous location where exception was thrown ---
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    

    My Code :

    public class LitmusPermissionDefinitionProvider : PermissionDefinitionProvider
        {
            protected IServiceProvider _serviceProvider { get; }
            public LitmusPermissionDefinitionProvider(IServiceProvider serviceProvider)
            {
                _serviceProvider = serviceProvider;
            }
    
            public override void Define(IPermissionDefinitionContext context)
            {
                var myGroup = context.AddGroup(LitmusPermissions.GroupName);
    
                var TestPermissionTestPermission = myGroup.AddPermission("TestRoles");
                var roles = GetRoles();
                foreach (var item in roles)
                    TestPermissionTestPermission.AddChild(item);
            }
    
            private string[] GetRoles()
            {
                var result = AsyncHelper.RunSync(() => _serviceProvider.GetRequiredService<IIdentityRoleAppService>().GetAllListAsync());
                return result.Items.Select(x => x.Name).ToArray();
            }
    
            private static LocalizableString L(string name)
            {
                return LocalizableString.Create<LitmusResource>(name);
            }
        }
    

    I tried your way, still stuck with same error. If I am doing it wrong way, please provide sample code.

    Thanks

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    The application service will try to get all permissions when you call the its method, it will be an infinite loop.

    So do not call application service in the Define method.

    You can get dynamic permissions through other ways. Sync methods are preferred.

  • User Avatar
    0
    lalitChougule created

    hi

    The application service will try to get all permissions when you call the its method, it will be an infinite loop.

    So do not call application service in the Define method.

    You can get dynamic permissions through other ways. Async methods are preferred.

    Please provide sample code, What are the other ways and what do u mean by Sync methods are preferred ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    HI

    It depends on where your dynamic permissions are stored. If your application is a monolithic application, you can consider try to inject the repository.

    In short, don't call application services, because this will cause an infinite loop.

  • User Avatar
    0
    lalitChougule created

    HI

    It depends on where your dynamic permissions are stored. If your application is a monolithic application, you can consider try to inject the repository.

    In short, don't call application services, because this will cause an infinite loop.

    Ok I got your point. What are the other ways of access roles ? I dont want to access permissions. I want to access all roles.

    I am not able to access IIdentityRoleRepository as well as IdentityRoleManager in the above code block.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Why you can't access IIdentityRoleRepository? Can you explain the structure of your project

  • User Avatar
    0
    lalitChougule created

    Hi,

    Why you can't access IIdentityRoleRepository? Can you explain the structure of your project

    I think we are trying to access it in Application.Contracts thatz why its not accessible.

    My Project structure

    Gateway
    	MainProject.HttpApi.Host
    Microservices
    	ProjectA.HttpApi.Host
    	ProjectB.HttpApi.Host
    	ProjectC.HttpApi.Host -- IdentityServer
    	ProjectD.HttpApi.Host
    Module
    	ProjectA
    		scr
    			ProjectA.Application
    			ProjectA.Application.Contracts
    			ProjectA.Domain
    			ProjectA.Domain.Shared
    			ProjectA.EntityFrameworkCore
    			ProjectA.HttpApi
    			ProjectA.HttpApiClient
    		test
    			ProjectA.Application.Tests
    			ProjectA.Domain.Tests
    			ProjectA.EntityFrameworkCore.Tests
    			ProjectA.HttpApiClient.ConsoleTestApp
    			ProjectA.TestBase
    	ProjectB
    		src
    			ProjectB.Application
    			ProjectB.Application.Contracts
    			ProjectB.Domain
    			ProjectB.Domain.Shared
    			ProjectB.EntityFrameworkCore
    			ProjectB.HttpApi
    			ProjectB.HttpApiClient
    		test
    			ProjectB.Application.Tests
    			ProjectB.Domain.Tests
    			ProjectB.EntityFrameworkCore.Tests
    			ProjectB.HttpApiClient.ConsoleTestApp
    			ProjectB.TestBase
    	ProjectC
    		src
    			ProjectC.Application
    			ProjectC.Application.Contracts
    			ProjectC.Domain
    			ProjectC.Domain.Shared
    			ProjectC.EntityFrameworkCore
    			ProjectC.HttpApi
    			ProjectC.HttpApiClient
    		test
    			ProjectC.Application.Tests
    			ProjectC.Domain.Tests
    			ProjectC.EntityFrameworkCore.Tests
    			ProjectC.HttpApiClient.ConsoleTestApp
    			ProjectC.TestBase
    	ProjectD
    		src
    			ProjectD.Application
    			ProjectD.Application.Contracts
    			ProjectD.Domain
    			ProjectD.Domain.Shared
    			ProjectD.EntityFrameworkCore
    			ProjectD.HttpApi
    			ProjectD.HttpApiClient
    		test
    			ProjectD.Application.Tests
    			ProjectD.Domain.Tests
    			ProjectD.EntityFrameworkCore.Tests
    			ProjectD.HttpApiClient.ConsoleTestApp
    			ProjectD.TestBase
    

    The code which I am trying to do is in Module of Gateway project.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi lalitChougule

    I don't recommend you to do this. But you can try to use Dapper to read the database directly.

  • User Avatar
    0
    ServiceBot created
    Support Team Automatic process manager

    This question has been automatically marked as stale because it has not had recent activity.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06