Imagine an e-commerce site where users can create their own stores.
I am developing an internal messaging system for such a website, and I am currently not deciding how to implement it on a database.
The following scenarios must be supported:
- [u => u] the user can send messages to another user;
- [u => s] the user can send a message to the store;
- [s => u] the store can send a message to the user;
- [s => uu] a store can send a message to all its customers.
If I had a simple table Messagesand the repository wanted to send a message to 10,000 users, I would need to insert 10,000 such records at the same time.
Another approach is to save PersonalMessagesboth BroadcastMessagesseparately and enter the BroadcastMessageReceivers"mapping" table . However, this approach complicates the work with individual messages, for example, deleting, displaying incoming and outgoing messages, etc.
Is there a recommended option given that I am using Entity Framework and MS SQL 2008?
source
share