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 !!!
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.
ABP Framework version: v3.0.4
UI type: Angular / MVC: Angular
DB provider: EF Core / MongoDB
Tiered (MVC) or Identity Server Seperated (Angular): yes / no : no
Exception message and stack trace: Working: http://localhost:4200/account;accountType=supplier/login Exptected Result: http://localhost:4200/account/login?accountType=supplier
Steps to reproduce the issue: We customize the AccountComponent
app.module.ts
@NgModule({
declarations: [AppComponent, AccountComponent, .....],
imports: [
AccountConfigModule.forRoot(),
IdentityConfigModule.forRoot(),
....
.....
],
entryComponents: [AccountComponent]
app-routing.module.ts
const routes: Routes = [
{
path: '',
loadChildren: () => import('./home/home.module').then((m) => m.HomeModule)
}
{
path: 'account',
loadChildren: () => import('@volo/abp.ng.account')
.then((m) => m.AccountModule.forLazy({ redirectUrl: '/' })),
},
{
path: 'dashboard',
loadChildren: () => import('./dashboard/dashboard.module').then((m) => m.DashboardModule),
}]
Home.component.ts
if (this.hasLoggedIn){
this.router.navigate(['dashboard'])
}else {
this.router.navigate(['account', { accountType: 'supplier' }]);
}
How to acheive this, Kindly give any suggestions
Thanks
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.
As Per requirement we need to show notification Icon on after login, So I am adding menu item as follwing this document
https://docs.abp.io/en/abp/latest/UI/Angular/Modifying-the-Menu#how-to-add-an-element-to-right-part-of-the-menu
In app.component.ts constructor( private navItems: NavItemsService) { navItems.addItems([ { id: 'notification-litmus', order: 1, component: LitmusNotificationComponent, }]) } Using NavItemService I added menu Item, It's adding after login, showing the menu item on menu as expected,
Issue: ngOninit hook of LitmusNotificationComponent calling even after logout, because of this whatever functions calling in oninit all are calling even after logout.
litmus-notification.component.ts export class LitmusNotificationComponent implements OnInit ngOnInit(): void { alert('oninit') } }
How to handle this? If need to remove item from navItems then How to do it ? , From Documentation I did not understood remove item from navItems?
Apart from this what I am doing wrong?
Kindly help"
Hi,
I want to implement Push notification in my application
for example myCart , If my user add anything in cart the count or badge number increases on the bell icon and customer receives a notification where there is a small message xyz product is added into your cart.
Document below just give only the idea how to integrate SignalR and that too on the API side not on Angular side. https://docs.abp.io/en/abp/3.1/SignalR-Integration
Please provide if any example is available.
Thanks
We are havng issue while initializing Volo.Abp.Identity.IdentityDataSeeder with Amazon.SecretManager.
1[[Volo.Abp.Identity.EntityFrameworkCore.IIdentityDbContext, Volo.Abp.Identity.EntityFrameworkCore, Version=3.0.4.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.. See the inner exception for details. ---- Autofac.Core.DependencyResolutionException : An exception was thrown while activating Volo.Abp.Identity.IdentityDataSeedContributor -> Volo.Abp.Identity.IdentityDataSeeder -> Volo.Abp.Identity.EntityFrameworkCore.EfCoreIdentityRoleRepository -> Volo.Abp.Uow.EntityFrameworkCore.UnitOfWorkDbContextProvider
1[[Volo.Abp.Identity.EntityFrameworkCore.IIdentityDbContext, Volo.Abp.Identity.EntityFrameworkCore, Version=3.0.4.0, Culture=neutral, PublicKeyToken=null]] -> Volo.Abp.MultiTenancy.MultiTenantConnectionStringResolver.
-------- Autofac.Core.DependencyResolutionException : An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptionsSnapshot`1[Volo.Abp.Data.AbpDbConnectionOptions], Volo.Abp.MultiTenancy.ICurrentTenant, System.IServiceProvider)' on type 'MultiTenantConnectionStringResolver'.
------------ System.AggregateException : One or more errors occurred. (1 validation error detected: Value null at 'secretId' failed to satisfy constraint: Member must not be null)
---------------- Amazon.SecretsManager.AmazonSecretsManagerException : 1 validation error detected: Value null at 'secretId' failed to satisfy constraint: Member must not be null
-------------------- Amazon.Runtime.Internal.HttpErrorResponseException : Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' 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.
As per this document can we use chart.js in abp ? https://docs.abp.io/en/commercial/latest/startup-templates/application/solution-structure#depended-packages
I am not able to find any document to implement chart.js in abp angular Can you please guide me how to do it ?
Hi,
I am trying to use CurrentUser by using Abp functionality
Volo.Abp.Users.ICurrentUser
Volo.Abp.Application.Services.ApplicationService.CurrentUser{get;}
I am not able to get CurrentUser details Please find my code below for reference :
public virtual async Task<SomeDto> GetDetailsByUserId()
{
var CurrentId = CurrentUser.Id;
var SomeId = _someRepository.Where(x => x.UserId == CurrentId)
.Select(x => x.someData).FirstOrDefault();
return _someOtherRepository.Where(x => x.SomeId == SomeId).Select(x => x.SomeCode).ToList();
}