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

  • Home
  • SEARCH
  • 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 8580237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:47:07+00:00 2026-06-11T20:47:07+00:00

I can use default design of MVC solution. For example, controller: public class ProductController

  • 0

I can use default design of MVC solution. For example, controller:

public class ProductController : Controller
   {
       private Entities db = new Entities();

       public ViewResult Details( int id )
          {
              Product product = db.Products.Single( p => p.ID == id );
              return View( product );
          }
    }

But I saw in some large projects, to call any method, they used only service, for example

public class ProductController : Controller<ISomeService>
{
 public ViewResult Details( int id )
    {
       Product product = MyService.GetProductById();
       return View( product );
    }
}

and not using database instance in the controller such as:

private Entities db = new Entities();

Models, DB and Business Logic are different projects in solution.

From where can I learn about this structure in any sample?
(sorry for bad English)

  • 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-11T20:47:08+00:00Added an answer on June 11, 2026 at 8:47 pm

    I would take a look at using dependency injection with ASP.NET MVC, here’s an article on the subject:

    http://weblogs.asp.net/shijuvarghese/archive/2010/04/30/dependency-injection-in-nerddinner-app-using-ninject.aspx

    Then take a look at using a Repository/UnitOfWork pattern with Entity Framework, another article:

    http://www.codeproject.com/Tips/309753/Repository-Pattern-with-Entity-Framework-4-1-and-C

    And if you’re not interested in doing all this code on your own, you can use, or at least take a look at how it can be done, here:

    http://mvcbootstrap.codeplex.com

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

Sidebar

Related Questions

In Asp.net MVC Razor we can use the _ViewStart.cshtml file to define the default
Can I use default arguments in a constructor like this maybe Soldier(int entyID, int
How can I use the default background image for a UIView?
As we use default keyword as a access specifier, and it can be used
Can I use java.util.Properties with encoding different then default?
Hi I am trying to make a global class that I can use in
How can I make floating windows use their design size (and not the Dock
I'm creating a new application using ASP.NET MVC. I'd like to use a series
I can use the following to get the contents of a folder with no
Users can use their Google, Facebook or Twitter account to login to a site

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.