arithma wroteIt also allows you to easily make the same user a Bidder and a Seller at the same time.
That's a major requirement in my design.
arithma wroteI would only be concerned on a more higher level: You are only a user at any instance, and you bid per project, and sell per product. So denoting a user as a bidder or seller is kind of meaningless.
Correct. The user might be a seller and a bidder at the same time, but not on the same listing/product.
arithma wroteThe only reason you may want to do that is to provide some kind of interface based on existence of these FK in the respective tables. In that case, a group-role/actions approach may be more appropriate (factoring in administration, ownership of items and so on..) It can get hairy, and these things are usually solvable but feel extremely brutish in execution.
I'm not really sure what you mean but I already planned to implement my own custom Membership and Roles providers. I do not want to use the built-in ones. But I'm still not sure I should include "Bidder" and "Seller" into the Roles unless I could find a way to tie the Roles to the Listing as well as the users. Hmmm, that sounds feasible.
arithma wroteAt any rate, your two additional tables are far better than two columns: IsBidder, IsSeller.
That's out of question. This will violate the requirement mentioned above.
rahmu wroteThe second case (b) could be a little more complicated. You definitely don't need two tables. Just the one (Users). But in each transaction, you'll have a Seller and one or more "Bidders". So what you could do is create the two classes, representing the same db table, but acting as different roles in each transaction.
This seems closest to what I'm looking for. So again, I'll have to hook-up the roles to a user with respect to each and every listing:
- The user that posted a Listing A is a Seller. Accordingly this user cannot bid on Listing A.
- Anyone else is a Bidder who can bid on Listing A.
So the way I think about it now is to stick to the Users table, but create a Seller and Bidder classes which will take care of determining the roles according to every listing.
What do you think?