Asp.net mvc inheritance controllers

Posted by Ris90 on Stack Overflow See other posts from Stack Overflow or by Ris90
Published on 2010-05-25T17:56:46Z Indexed on 2010/05/25 18:01 UTC
Read the original article Hit count: 228

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)

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about inheritance