Thank you @gterdem !!!
Hi,
This is the angular service code as below :
selectedInvoicesToExcelDownloadByInput(body: any): Observable<any> {
let url = `${this.apiUrl.url}/api/InvoiceManagement/AR/invoice/selectedInvoicesToExcelDownload`
return this.http.post(url, body, {
responseType: 'blob'
})
}
Thie is the method where service method is called, code as below :
this.Invoiceservice.selectedInvoicesToExcelDownloadByInput(program).subscribe((res) => {
var blob = new Blob([res], { type: res.type.toString() });
var url = window.URL.createObjectURL(blob);
var anchor = document.createElement("a");
anchor.download = this.fileformatName();
anchor.href = url;
anchor.click();
});
What I need is to get access of the below marked blue rectangle :
How do I access this ? If I go with normal approach of state as per document I get parsing error where I cant prase my returned blob to excel file. The only way I was able to generate excel file is by implementation done above, but now I cannot access the name of the file.
Code sample will help alot !!!
Hi @alper,
Below code is for Executing SP on SQL server:
public async Task UpdateEmail(Guid id, string email, CancellationToken cancellationToken = default)
{
await DbContext.Database.ExecuteSqlRawAsync(
"EXEC UpdateEmailById @email, @id",
new List<object> {new SqlParameter("id", id), new SqlParameter("email", email)},
cancellationToken);
}
I am using PostgreSQL 13 , Is this the same way to execute it on PostgreSQL and even I am not able to find SqlParameter i.e. new SqlParameter("id", id)
do I need to install any package for same ?
Hi @alper,
As stated above my custom repo method performs 2 operations
public virtual async Task CreateQuote()
{
using (var uow = _unitOfWorkManager.Begin(requiresNew: true, isTransactional: true))
{
//...my code
//custom repository bulk update called
//ERROR OCCURED
await uow.CompleteAsync();
}
}
So as per what you are saying all the updates and inserts will be roll backed in the above cenario right ?
Hi @hikalkan
My method is POST method, So it's starting transaction. If you are sure that your UOW is transactional, then we will try to reproduce it in our side -- YES I AM SURE
My custom repository method is performing 2 operations at a time.
My Requirement ->
1st operation : To update table XYZ_1 where I update status of some records in bulk. 2nd operation : Is to insert the id's of updated records and the changed status in another XYZ_2 table which I later on use for auditing and other operations.
Issue : Even if my update fails I found that, from almost 40k records very small amount of records got inserted in 2nd operation (around 10-20 records)
Hi @liangshiwei,
My code is almost same as your code. Even I thought it was working fine, while trying to recreate the same issue I was able to recreate it only once in 9-10 attempts. If you can read the comments for ExecuteSqlRawAsync in it's Interface it says :
Executes the given SQL against the database and returns the number of rows affected.
Note that this method does not start a transaction. To use this method with a
transaction, first call Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.BeginTransaction(Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade,System.Data.IsolationLevel)
or Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.UseTransaction(Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade,System.Data.Common.DbTransaction).
Note that the current Microsoft.EntityFrameworkCore.Storage.ExecutionStrategy
is not used by this method since the SQL may not be idempotent and does not run
in a transaction. An ExecutionStrategy can be used explicitly, making sure to
also use a transaction if the SQL is not idempotent.
My question here is how can I use this in my cenario so I can use my methods transaction or in anyway I can able to execute my SQL in same transaction or something : Microsoft.EntityFrameworkCore.RelationalDatabaseFacadeExtensions.UseTransaction(Microsoft.EntityFrameworkCore.Infrastructure.DatabaseFacade,System.Data.Common.DbTransaction)
Continues for the same question Is there any way to get Current User Id in angular ?
Hi @alper,
I tried to implement "Multi Lingual Entity" I created the Entity using IMultiLingualEntity & IEntityTranslation as per the document
But I got stuck in this part CreateMultiLingualMap https://aspnetboilerplate.com/Pages/Documents/Multi-Lingual-Entities#createmultilingualmap
If you can guide me how to map the entities , It will be helpful
Thanks
Thanks alot @liangshiwei It worked
Hi,
As you said I tried implementing AudtingStore
.
But I was not able to log the data like AbpAuditLog
.I think I missed out something
I got reference from the source code
Below is my code , Please help if something is wrong in the implementation
[Dependency(TryRegister = true)]
public class AWSAuditingStore: IAuditingStore, ISingletonDependency
{
public ILogger<AWSAuditingStore> Logger { get; set; }
public AWSAuditingStore()
{
Logger = NullLogger<AWSAuditingStore>.Instance;
}
public Task SaveAsync(AuditLogInfo auditInfo)
{
Logger.LogInformation("AWSAuditingStore : {0}", auditInfo.ToString());
return Task.FromResult(0);
}
}
Thanks @liangshiwei
It will be very helpfull if u can provide some sample code to demonstrate implementation of custom AudtingStore