views:

49

answers:

0

I have a scenario in which I need advice on. I have an application where there are two kinds of users Student and Teacher. Student and Teacher share some of the common properties like FirstName, LastName, Email, UserName, Password etc. For this reason I derive Student and Teacher classes from User.

Now, the problem is that there are times where I don't really know that if the user is student or teacher. Like when implementing a custom membership provider and in the GetUser function. GetUser takes userName but now I lost that what should I return.

For Student functions I have created IStudent and ITeacher for teachers. But sometimes I just want to return a User and do not care about if he is student or teacher. But then returning base class does not seems like a good idea too.

UPDATE:

I think it is good idea to return User and not even have Student and Teacher classes. Student and Teacher are simply the roles and can be managed by StudentServices and TeacherServices.