Breeze / breeze.server.net

Breeze support for .NET servers
MIT License
76 stars 62 forks source link

Cancellation Token #189

Closed GioviQ closed 8 months ago

GioviQ commented 1 year ago

I would like to add CancellationToken support in https://github.com/Breeze/breeze.server.net/blob/master/DotNet/Breeze.AspNetCore.NetCore/QueryFilter.cs

(see also https://stackoverflow.com/questions/58212604/is-cancellationtoken-available-in-asp-net-core-actionfilter)

Can you give me a hint to implement this new feature?

steveschmitt commented 1 year ago

It seems that you could get the CancellationToken from the HttpContext as described in that StackOverflow post. Then, in the QueryFilter, you could call cancellationToken.ThrowIfCancellationRequested() to abort the query.

steveschmitt commented 12 months ago

@GioviQ I've merged changes from @biegehydra to add the CancellationToken support to BreezeQueryFilter. It's in the master branch now, if you want to take a look.

I'll keep this issue open until the feature has shipped (i.e. new versions of the Nuget packages have been released.)

steveschmitt commented 8 months ago

Finally released this change, in version 7.2.0! Sorry I didn't get to it sooner.