REQUIREMENT
I refered to this link https://docs.abp.io/en/abp/3.1/Modules/Organization-Units But not sure how to use it in this specific requirement. Even if there is any other feature of abp which will help me to achieve this functionality can help. Please provide few detail points or examples or docs where I can get complete understanding related to my requirement.
Thanks!!!
Hi,
I want to change the UI Administration page and its content, we are using angular material in our project. How do I do it ?
Hi,
I am working with Authorization, Roles and Permission on Microservice architecture.
I have one role i.e. Anchor in which I have created few policies as below
Case 1 : On my Role permission level i.e. Anchor I have only check box selected for Supplier Now I have one User i.e. Anchor.Admin, On user permission Ievel I have options like Supplier which is already selected, I assume this is because role(i.e. Anchor) have this option selected. Now I select one more policy for this user like say Supplier.View Expectation : Anchor.Admin should see supplier tab/menu and once the user click on view button user should be able to see the data on the popup screen because this user have Supplier.View policy selected in User permission level screen.
Case 2 : On my Role permission level i.e. Anchor(same role as case 1) I have only check box selected for Supplier Now I have one User i.e. AnchorForCheck.Admin, On user permission Ievel I have options like Supplier which is already selected, I assume this is because role(i.e. Anchor) have this option selected. Expectation : Anchor.Admin should see supplier tab/menu but once the user click on view button user should not be able to see the data on the popup screen because this user have only Supplier policy selected and no other is selected in User permission level screen.
AppService Level :
I have this annotation in place above my method [Authorize(ProfileManagementPermissions.Supplier.View)]
My Issue : In both case 1 and case 2 because of the authorize annotation placed on my method I am getting this error on UI :
An error has occurred!
Authorization failed! Given policy has not granted
But on my browsers if I check in network I am getting proper data for grantedPolicies :
Case 1:
Case 2:
One more thing I need to highlight here is on my ApplicationService level I dont get info like CurrentUser.Id and CurrentTenant.Id Is this something to do with my architecture or am I missing any refrences or something. I need to make it work for my Role + User level combination of permissions, as case 1 and 2 discussed above. In case you need more details for understanding, Please do ask.
Thanks
Hi, I want to remove/hide the red color box content like Audit Logging permissions and other policies from the UI. This is for my Tenant admin UI and I don't want to give irrelevant/unnecessary options for my user to play around with. Where do I need to do respective changes. I was not able to find it in doc's.
Thanks
Controller.cs
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SCV.Litmus.LitmusUsers;
using Volo.Abp;
namespace SCV.Litmus.Controllers.LitmusUsers
{
[RemoteService]
[Route("api/ApplicationManagement/litmusUser")]
public class LitmusUserController : LitmusController, ILitmusUserAppService
{
private readonly ILitmusUserAppService _litmusUserAppService;
public LitmusUserController(ILitmusUserAppService litmusUserAppService)
{
_litmusUserAppService = litmusUserAppService;
}
[HttpPost]
public virtual Task<LitmusUserOutputDto> CreateAsync(LitmusUserCreateDto input)
{
return _litmusUserAppService.CreateAsync(input);
}
}
}
My swagger is showing 2 end points
Two end point which are as below :
/api/ApplicationManagement/litmusUser/createUser
-- My custom route/api/app/litmusUser
-- Auto generatedI just want my controller to create 1 route which is 1st /api/ApplicationManagement/litmusUser/createUser
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
This my Microservice folder 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
I want to create user in Project B ApplicationService by using IdentityUserManager
. I am not able to access IdentityUserManager
in Project B
Am I missing anything with reference ?
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
While updating from multiple threads, the updateAsync() throws error sometime not always, error as below
Exception - Volo.Abp.Data.AbpDbConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
I tried using await CurrentUnitOfWork.SaveChangesAsync();
but then my Db went into DeadLock state.
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
The issue occures while doing unit test cases are as below
There are few more issue I am facing where the code works fine in Production but giving error while Unit Testing, Are there any limitation for testing ? If yes then how to overcome them ?
Please find below error log for your reference. Thanks
Exception Messages :
System.NotSupportedException : SQLite cannot order by expressions of type 'decimal'. Convert the values to a supported type or use LINQ to Objects to order the results.
Stack Trace:
SqliteQueryableMethodTranslatingExpressionVisitor.TranslateThenBy(ShapedQueryExpression source, LambdaExpression keySelector, Boolean ascending)
QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
Database.CompileQuery[TResult](Expression query, Boolean async)
QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
<>c__DisplayClass12_0`1.<ExecuteAsync>b__0()
CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
QueryCompiler.ExecuteAsync[TResult](Expression query, CancellationToken cancellationToken)
EntityQueryProvider.ExecuteAsync[TResult](Expression expression, CancellationToken cancellationToken)
EntityQueryable`1.GetAsyncEnumerator(CancellationToken cancellationToken)
ConfiguredCancelableAsyncEnumerable`1.GetAsyncEnumerator()
EntityFrameworkQueryableExtensions.ToListAsync[TSource](IQueryable`1 source, CancellationToken cancellationToken)
InvoiceAppService.GetCreditNotesForInvoiceSelectionAsync(List`1 supplierCodes) line 1412
InvoiceAppService.ApplyInvoiceLinkedCreditNotesAsync(GetQuoteInputDto input) line 1455
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
InvoiceApplicationTests.ApplyInvoiceLinkedCreditNotesAsync() line 451
Message:
System.InvalidOperationException : The LINQ expression '(GroupByShaperExpression:
KeySelector: new {
StatusId = (i.StatusId),
Code = (t.Code)
},
ElementSelector:(EntityShaperExpression:
EntityType: Invoice
ValueBufferExpression:
(ProjectionBindingExpression: EmptyProjectionMember)
IsNullable: False
)
)
.Sum(x => x.Amount)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
Stack Trace:
RelationalSqlTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
RelationalSqlTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
RelationalSqlTranslatingExpressionVisitor.Translate(Expression expression)
RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
RelationalProjectionBindingExpressionVisitor.VisitMemberAssignment(MemberAssignment memberAssignment)
ExpressionVisitor.VisitMemberBinding(MemberBinding node)
RelationalProjectionBindingExpressionVisitor.VisitMemberInit(MemberInitExpression memberInitExpression)
MemberInitExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
RelationalProjectionBindingExpressionVisitor.Visit(Expression expression)
RelationalProjectionBindingExpressionVisitor.Translate(SelectExpression selectExpression, Expression expression)
RelationalQueryableMethodTranslatingExpressionVisitor.TranslateSelect(ShapedQueryExpression source, LambdaExpression selector)
QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
RelationalQueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
MethodCallExpression.Accept(ExpressionVisitor visitor)
ExpressionVisitor.Visit(Expression node)
QueryCompilationContext.CreateQueryExecutor[TResult](Expression query)
Database.CompileQuery[TResult](Expression query, Boolean async)
QueryCompiler.CompileQueryCore[TResult](IDatabase database, Expression query, IModel model, Boolean async)
<>c__DisplayClass9_0`1.<Execute>b__0()
CompiledQueryCache.GetOrAddQueryCore[TFunc](Object cacheKey, Func`1 compiler)
CompiledQueryCache.GetOrAddQuery[TResult](Object cacheKey, Func`1 compiler)
QueryCompiler.Execute[TResult](Expression query)
EntityQueryProvider.Execute[TResult](Expression expression)
Queryable.FirstOrDefault[TSource](IQueryable`1 source)
InvoiceAppService.GetInvoiceSummaryAsync(InvoiceSummaryInputDto input) line 221
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
AuthorizationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
InvoiceApplicationTests.GetInvoiceSummaryAsync() line 188
--- End of stack trace from previous location where exception was thrown ---
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
Hi,
There is a case where I have to update more than 40k records in a single go.
What I tried : 1st Approach
foreach (var item in xyzList_1)
{
var data = await xyz_repository.GetAsync(item.Some_Id);
if (data != null)
{
data.FieldName = xyz;
await xyz_repository.UpdateAsync(data);
}
}
The above code block for 40k invoices was taking too long to execute, So I decided to switch to rawSQL query where I tried to pass all the Id's in IN_CLAUSE as below.
2nd Approach:
UPDATE "XYZ_TABLE" SET "FieldName" = 'some_value' WHERE "Id" IN (...)
The above code is in my custom repository , sample given below :
public async Task<int> UpdateRecods(string inClauseData)
{
return await DbContext.Database.ExecuteSqlRawAsync(UPDATE "XYZ_TABLE" SET "FieldName" = 'some_value' WHERE "Id" IN (inClauseData));
}
1st approach was in UOW transaction and used to roll back if there was any error in the process but is too slow as per performance point of view. 2nd approach is fast but doesn't roll back the changes.
There is a similar thing happening for bulk insert as well. Basically my requirement is to perform BULK CRUD in a single transaction scope.
I need a solution on both aspects which are rollback if any issue and performance. If you can suggest any other approach I am good with it.
Thanks !!!
I am using PostgreSQL functions and stored procedure.
I tried using it this approach https://khalidabuhakmeh.com/add-custom-database-functions-for-entity-framework-core
but I got below error: [ERR] xyzFunctionName cannot be called client side
Tried to look into abp document but no luck.
Please provide sample code if available. Thank you in advance !!!