I have a small API application on ASP.NET MVC. One of my endpoints creates an entity and stores it in the database.
Are there any tools that could change this entity after some time (for example, 1 hour)? I.e. I need to perform work automatically on this entity after some time.
I found the library Quartz.NET but it's like it's not really appropriate in this situation. As I understand it, Quartz provides a BackgroundWorker that runs at set intervals.
P.S. I also want to be able to save deferred processes in memory so that after restarting the program all deferred tasks are restored (but I understand that I'm asking too much)
Basically, you need something that will trigger your code. Most of the approaches includes some kind of interval under the hood. Quartz.NET is the post popular solution for this kind of tasks. Also, it includes persistence capabilities, so you don't need to worry about
Also, if you need for example, to mark your entity as expired or something like that. You can leverage fact that no one knows what is in the database, unless they call your API. So you can do that in a "lazy mode" – handle that logic when entity will be requested. Lets say, you have endpoints:
POST /entityto create Entity;GET /activeto list active Entities;And lets assume you need that Entity to disappear from the
/activelist after 1 hour. So in the/activehandler you can check for the expiration and update accordingly.