I’m writing a website similar to Amazon. Each user can open a shop.
Thus the database has a Shop table, whose primary key is id. Each user can open at most one shop.
I know I can use Profile Provider. I have been already using it to save the user’s address, telephones, and that sort of information. But I think saving shop id to Profile is not a good idea, because I can not use SQL to find out the shop owner’s name of a given shop, which makes that I can not use the off-the-shelf data controls without code-behind to complete my function on the shop page.
So can I modify aspnet_Users table adding a shop field which is a foreign key to Shop table? Will it cause problems?
Or I built another User table and put shop field in it?
Or do you have any best practice of doing that sort of things?
Don’t touch
aspnet_Users. It’s managed by ASP.NET’s membership provider, it might be changed in the future, lots of views and stored procedures touch it etc.I recommend saving all profile data in a distinct table(s) and that’s including name, address, whatever. That would also include each user’s
ShopID(as a one-to-one relationship, I think it’s preferable, although you can do as @Tim suggested with many-to-many).