Store seperate sets of users in two tables or single table using ASP.NET MVC5 Identity framework? -
i building saas application using asp.net mvc 5, need store 2 different types of users have different field information stored each. there subscibers , general users, every general user belong subscriber. so, every user have parent subscriber.
should have single aspnetusers table store users (subscriber / general users) custom columns stored each within same table? believe there has better practice achieve this. since saas application storing user information across multiple entities in single database, kind of database design should go for?
for reference, here database design have moment -
id [primary key of user] email password sub_name [subscriber name. populated if user subscriber] sub_address [subscriber address, populated if user subscriber] status [stores if user active] parent_id [id of parent. populated if user general user]
apart above, registering role of every user (subscriber/general user)
please advise. thank help.
you should use single table , create 2 classes in code different types of users. asp tables entity framework use table per hierarchy (given away discriminator column):
public class subscriber : identityuser { public virtual list<generaluser> generalusers {get; set;} //other properties }
and create general users:
public class generaluser : identityuser { public virtual subscriber subs {get; set;} //other properties }
Comments
Post a Comment