Green.CT.Asyncify.Net
1.0.0
dotnet add package Green.CT.Asyncify.Net --version 1.0.0
NuGet\Install-Package Green.CT.Asyncify.Net -Version 1.0.0
<PackageReference Include="Green.CT.Asyncify.Net" Version="1.0.0" />
paket add Green.CT.Asyncify.Net --version 1.0.0
#r "nuget: Green.CT.Asyncify.Net, 1.0.0"
// Install Green.CT.Asyncify.Net as a Cake Addin #addin nuget:?package=Green.CT.Asyncify.Net&version=1.0.0 // Install Green.CT.Asyncify.Net as a Cake Tool #tool nuget:?package=Green.CT.Asyncify.Net&version=1.0.0
Asyncify
Some times we have a api that must handle heavy request; for example, an api that adds a list of items to database and it's consumes bunch of times!
Asyncify
will handle this problem. It will run your request in new background thread and end-user will not wait for response.
Installation
Asyncify
is installed from NuGet.
dotnet add package Asyncify.Net
Documentation
At first, use AsyncRequest
attribute on the request which you need to run it as async
[AsyncRequest(nameof(Index))]
public IActionResult Index()
and then add AsyncController
attribute on controller that request is included in it.
[AsyncController(typeof(ProductsController))]
public class ProductsController : Controller
Finally, register the middleware to handle your async requests:
app.UseAsyncRequest();
For tracking response of your request, Asyncify
will add an api with /async
that accept trackId
as a query and return response in this template:
public class AsyncRequestDto(
Guid trackId,
AsyncRequestStatus status,
object? result)
{
public Guid TrackId { get; } = trackId;
public AsyncRequestStatus Status { get; } = status;
public object? Result { get; } = result;
}
Every async request can some status that will showed in Status
property, and the your Dto
will filled in Result
propery.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.OpenApi (>= 8.0.3)
- Microsoft.AspNetCore.Routing (>= 2.2.2)
- Newtonsoft.Json (>= 13.0.3)
- Swashbuckle.AspNetCore (>= 6.5.0)
- Swashbuckle.AspNetCore.Annotations (>= 6.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 127 | 4/1/2024 |