Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8166953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:03:30+00:00 2026-06-06T20:03:30+00:00

May be a stoopid question: I have a number of reference tables in an

  • 0

May be a stoopid question:

I have a number of reference tables in an application database, which I want to be updated from my MVC3 site.

I can create a “ReferenceController” which has CRUD methods for each of these tables

or

I can create a “EntityController” which has CRUD methods JUST for this one reference table (entity).

Not sure if there is a sensible pattern to follow for this?


EDIT:

If I do create a controller per Aggregate, then how do you name the methods on the controller?

e.g.
ReferenceController.CreateBusiness();
MyApplication/Reference/CreateBusiness
?

I have multiple, totally unrelated “reference” entities, would that mean a controller with a very large number of methods in there?
e.g. List, Create, Read, Update, Delete + confirmations?

Can you make controller methods Generic and have Create(T …) ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:03:32+00:00Added an answer on June 6, 2026 at 8:03 pm

    I would do something like this:

    A Generic Crud Repository like:

    class CrudRepo<TEntity> where T : class{
      void All();
      void Add(TEntity entity);
      void Edit(TEntity entity);
      void Delete(TEntity entity);
    }
    

    Then A generic Crud Controller like

    class CrudController<TEntity> where T : class{
        CrudRepository<TEntity> Repository;
    
        [HttpPost]
        ActionResult Add(TEntity entity){
          Repository.Add(entity);
        }
    
        // Similer for other actions
    }
    

    And for specific type of entities, just extend CrudController like:

    class StudentController : CrudController<Student>
    

    Edit 1:

    If you have really TOOOO many entities, there are ways to eliminate the need of inheriting the CrudController for each entity. You may want to write your custom ControllerFactory for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

May be it sound dumb but if I want some computed value from other
May be a simple question, but if I have a ModelForm: class ExampleModelForm(forms.ModelForm): class
May be you can help me: I have a tables: 1: Users id username
May be a simple question.. I have an interface: public interface ISanitizer { T
May be a silly question, but what's a class called that inherits from NSManagedObject?
may i know how to copy xml files from rc/ to class/ when compile
May someone please explain what exactly acceptance test for QuickFix have to do(test for)?
May be this question is too easy or I did not know how easy
May I know how to store an image manually into a database without using
May be a dirty question. Is there a simpler way in C# code to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.