DannyRoastBeef㊙
DannyRoastBeef㊙
CC#
Created by DannyRoastBeef㊙ on 2/6/2025 in #help
✅ How do I abort a long running API request manually?
Thanks for the help I'll give this a go!
39 replies
CC#
Created by DannyRoastBeef㊙ on 2/6/2025 in #help
✅ How do I abort a long running API request manually?
@TeBeCo @Sehra Thanks for the input guys. I'm simply wanting a cancel button on the front end to fire some sort of cancellation request on the backend to abort a long running task. It only currently fires when I close the browser tab or navigate using the back button. I assumed I'd have to wire up a separate API endpoint to fire internal cancellation tokens within it to get what I was looking for. I think it might as as simple as what you say. I was under the assumption that I'd need to call the specific API endpoint I'd initially sent the request to for it to pipe through the above mentioned 'CancellationToken' parameter on the initial endpoint. Look like this 'RequestAborted()' fires for the entire context which is probably what I need. I'll try just calling a fetch in the way you suggest. I think I might have overcomplicated it.
39 replies
CC#
Created by DannyRoastBeef㊙ on 1/6/2025 in #help
Why is my EFCore code saturating my Postgres database connection pool?
I figured it out. I'm calling the database asynchronously in a method that isn't even asynchronous. 💀
3 replies
CC#
Created by DannyRoastBeef㊙ on 1/6/2025 in #help
Why is my EFCore code saturating my Postgres database connection pool?
3 replies
CC#
Created by DannyRoastBeef㊙ on 4/3/2024 in #help
Using ref for large data types.
Right! Thanks for your help with a succinct answer and explanation. I was getting sick of trying to decipher the correct approach from StackOverflow :blobthumbsup:
10 replies
CC#
Created by DannyRoastBeef㊙ on 4/3/2024 in #help
Using ref for large data types.
Hi thanks for the reply. What about if I was to pass a list containing incoming data as I am here in my GET endpoint?
[HttpPost]
[Route("upload")]
public async Task<IActionResult> UploadDataAsync(List<IFormFile>? files)
{
if (files is not null && _env is not null)
{
return await _checkpoint.SaveDataToStorage(files);
}
return new StatusCodeResult(400);
}
[HttpPost]
[Route("upload")]
public async Task<IActionResult> UploadDataAsync(List<IFormFile>? files)
{
if (files is not null && _env is not null)
{
return await _checkpoint.SaveDataToStorage(files);
}
return new StatusCodeResult(400);
}
In the following function I've got
public async Task<IActionResult> SaveDataToStorage(List<IFormFile> files)
{
List<IFormFile> incomingFiles = files;

if (!CheckValidFileTypes(incomingFiles))
{
return new UnsupportedMediaTypeResult();
(There's more going on in here , shortened it for this post)
}
}
public async Task<IActionResult> SaveDataToStorage(List<IFormFile> files)
{
List<IFormFile> incomingFiles = files;

if (!CheckValidFileTypes(incomingFiles))
{
return new UnsupportedMediaTypeResult();
(There's more going on in here , shortened it for this post)
}
}
Would it be correct to put ref in front of
incomingFiles
incomingFiles
when calling the
CheckValidTypes
CheckValidTypes
function or will that do a copy?
10 replies
CC#
Created by DannyRoastBeef㊙ on 7/3/2023 in #help
❔ Can anyone break down this one-line code for me?
Oh so it's a lamda, I see. I think I'm going to have to read up on lamdas and Actions too. Thank you for your help, you've put me on the right track. 👍
11 replies
CC#
Created by DannyRoastBeef㊙ on 7/3/2023 in #help
❔ Can anyone break down this one-line code for me?
I'm not sure in this context haha. I'm under the impression => is used for lambda declaration and expression based properties. What does it mean in this context?
11 replies