C
C#2y ago
barcode

❔ EFCore One-To-One

Hello, I am trying to save working hours as an entry in the database for each business. One approach is to store 14(7 days * 2 from,to) columns, other approach I thought of is to move this to a separate entity WorkingHour which contains from and to and have 7 of them. How would I make the entity convertible to db since it is not normal int, string and it is not a separate entity with a separate table?
5 Replies
phaseshift
phaseshift2y ago
you could use an owned type so then its not 'an entity'
barcode
barcodeOP2y ago
ty gonna research it
TravestyOfCode
Also could have a table with BusinessId, Day, From, and To columns? Then you can have a relation of one business to many WorkingHours. Would also support having multiple working periods for a business. Say, Monday 9 to 11:30 and 12:30 to 5.
barcode
barcodeOP2y ago
Hmm good catch that it could have multiple schedules
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?