views:

66

answers:

0

Hi, I'm studing asp.net mvc and in my test project I have some problems with inheritance: In my model I use inheritanse in few entities:

public class Employee:Entity
    {
        /* few public properties */
    }

It is the base class. And descendants:

public class RecruitmentOfficeEmployee: Employee
    {
        public virtual RecruitmentOffice AssignedOnRecruitmentOffice { get; set; }
    }

public class ResearchInstituteEmployee: Employee
    {
        public virtual ResearchInstitute AssignedOnResearchInstitute { get; set; }
    }

I want to implement a simple CRUD operations to every descedant.

What is the better way to inplement controllers and views in descendants: - One controller per every descendant; - Controller inheritance;
- Generic controller; - Generic methods in one controller.

Or maybe there is an another way?

My ORM is NHibernate, I have a generic base repository and every repository is its descedant. Using generic controller, I think, is the best way, but in it I will use only generic base repository and extensibility of the system will be not very good.

Please, help the newbie)