How to store Dio's CancelToken in database column? #1312
-
|
I have a table called: I also want to store dio's maybe like this: My need is how can I store Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
It's not possible to store a I think the cleanest approach would be to handle cancellations somewhere out of the database. You could in theory have a global map |
Beta Was this translation helpful? Give feedback.
It's not possible to store a
CancelTokenin a database, it's not data. Data persisted in a database survives app restarts, while cancel tokens (and uploads in general) do not.I think the cleanest approach would be to handle cancellations somewhere out of the database. You could in theory have a global map
<int, CancelToken>somewhere. When you create a new token, you increase some counter and store it in that map. A type converter could then store the token's id an look it up as necessary. But that's really not a great solution, I wouldn't store cancel tokens in a database because they don't persist.