开发者

Reocurring until infinity

开发者 https://www.devze.com 2023-02-25 09:51 出处:网络
L开发者_高级运维et\'s say I wanted to display a Reminder (dynamically created by user) in my ASP.NET MVC View

L开发者_高级运维et's say I wanted to display a Reminder (dynamically created by user) in my ASP.NET MVC View Every WEEK/MONTH/.... until "infinity".

This reminder has to be seperate database record (or in my case EF Entity Instance object) for each reocurrence, because i'm storing specific data in my database for each occurrence.

How would you guys go about "inserting" these reminder clones into the database? I Can't insert infinite reminders, .. And choosing an arbitrary date say "2000 years" from now seems wrong, and also inserts a lot of records into the database.

Kind of clueless here...

Thanks in advance for any (alternative) solution/ advice. *It is key tough that i can store data for each occurence!*


Inserting reminders into the database, IMHO, is a bad way of implementing it. It is just lazy.

My approach would be to store the conditions and then test the conditions on a regular basis. Perhaps just keeping a timestamp of last reminder check and if it is more than 8 hours, re-calculate - something around these lines.


UPDATE

In order to know which reminder has been seen by the user or not, for every type you just keep a timestamp of when it was read. If the difference is more than the item interval, then it must be shown. If timestamp is less than the the time reminder must be shown, then it must be shown.


Is there the remotest possibility that your code will be used in 10 years time? If not try 10 years.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号