Modeling Recurring Transactions in Core Data
I'm having a hard time coming up with a conceptual model for a recurring transaction scheme in Core Data. So far I have:
1) A BillMaster entity (referenced above) which has a开发者_运维技巧ttributes like "due date" "title" etc.
2) A BillEntry entity which is basically the children of the master bill, the actual bills you would see on the calendar. These would point to the master data for due date, title, and would also keep track of whether this instance of the bill has been paid or not.The problem is, I'm going to need to duplicate these masters and create the recurring children entries in a way that's efficient, one for every time the bill recurs. I'm not sure when this entry generation should actually occur, and how far out it should go for. I also don't want to accidentally re-generate these when it's not necessary to. Maybe there's even a smarter way to model this out that I'm not thinking of.
If there are any suggestions any of you have, or maybe some good reading material that goes over conceptual things like this, I'm open to anything. I have a fairly good understanding of Core Data in general (fairly good, no expert by any means) but some of these more complex models still throw me for a loop.
There's about 5 different "Core Data" that comes up. MacOS ?
But anyway, it seems that your question is generic, not specific to Core Data. Basically, assuming the BillMaster is correct, somewhere in your app, you need a button for "Generate Bills". Simply project BillMaster into BillEntry, for whatever BillMasters are billable right now.
- just one, if monthly, and the next month has not been billed
- otherwise pickup all iterations since the last time the user hit that button
- and none at all if they keep hitting the button (the next projection will find no BillMasters that are billable).
精彩评论