0
votes

I have my own tables for the users in my database. They're called Teachers and Students. I was testing ASP.NET MVC4 SimpleMembership but I guess I need to create a new membership provider.

Each table has its own password field (plain text)

enter image description here

Here's the image of my design. I would like to know if this is a good way to login and identify which user type (student or teacher) is logging or can I simplify this just using one table called Users and not to implement my own custom membership (using default UserProfile)

2
why can't you use simple membership? You can have your own tableAdam Tuliper - MSFT
Can you show me an example? Until I know, simple membership only use one table called UserProfiles and I need to extend two types of user (Student and Teacher)Darf Zon
SimpleMembership doesn't constrain you to any profile setup, there's really no profile setup. Simply create your profile info after your user is created so you have the primary key of your user. That's the easier part of simple membership, you can just be kn control of your data again- so yes - it's just another table you can read using say entity framework once your user logs in.Adam Tuliper - MSFT

2 Answers

2
votes

Normally when designing a membership system, you start with a base users table. Then from there, you could have user_types (which may be Students, Teachers, or anything else in the future like Parents). In your application, you can then test to see which type of user is logging in and respond accordingly.

If you need to store additional data for a specific user type, for example teachers, then you can create a table that adds on to the base users table, and replicate this in your models by having a Teacher model extend the base User model, adding any teacher-specific logic you may need.