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 9165953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:02:19+00:00 2026-06-17T15:02:19+00:00

working on asp.net MVC from quite some time now today stuck on a theoretical

  • 0

working on asp.net MVC from quite some time now
today stuck on a theoretical problem
going through some sample code on MSDN
I read something like this

public class SomeController()
{
 public ActionResult SomeAction(SomeModel model)
 {
   var dataContext = new SomeDataContext();
   //basic CRUD operations on data context
   //
 }
}

here the database obviously is being accessed through the controller and by theory is incorrect
is there something wrong with this example or my definition of what a model and what a controller is needs to be refreshed
UPDATE:-
or there is a possibility that every where on MSDN Models and ViewModels are considered equal

  • 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-17T15:02:23+00:00Added an answer on June 17, 2026 at 3:02 pm

    intro

    MVC design pattern is quite old. It was originally defined for Smalltalk-80 applications, when "web" was two guys sending ping between universities. Since then it has evolved quite a lot.

    The core principle behind MVC design pattern is Separation of Concerns. The pattern separates presentation from business logic. Presentation layer contains mostly views, controller, templates, viewmodels and presenters (depending on which flavor of MVC-inspired patterns you use), while business logic is ends in the model layer.

    The model layer, while not strictly defines in the pattern, in ASP.NET MVC consists of services and all the structures that are used by service (including the Model Objects, better known as domain objects).

    regarding the question

    It is quite common to see DataContext uses in controllers, when you are looking for basic MVC tutorials. MVC architecture is meant of large scale applications, and in a Hello-World example a fully realized MVC architecture would look like just bloat.

    The examples sacrifice code separation for sake of simplicity. The interaction with DataContext is basically storage logic, which is one of tasks that model layer handles. When used in controller, it means that your model layer has begun leaking in the presentation layer, and you end up with "Fat controller, skinny model" problem.

    In a real world application the DataContext would be part of structure that deal with persistence within model layer. Probably as part of data mappers, if you opt to write them manually.

    regarding "update"

    The model (I suppose in this case you meant Domain/Model object) is from completely different application layer then ViewModel.

    As the name implies, in MVVM pattern the ViewModels replace the Controllers. ViewModel acquired data from model layer, and then transforms it in such a way that is usable for View.

    This pattern is best used (if you are really using MVVM) in situation when you do not have full control over behavior over Views or/and Model layer. For example: if you were hired to build an alternative frontend for SAP or when the view is actually some form of hardware device, which expects specific type of input.

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

Sidebar

Related Questions

For some time I am worknig in MVC, I learnt from this post, http://evolpin.wordpress.com/2011/04/12/asp-net-mvc-partialview-with-ajax/#comment-435
I've been working with ASP.NET(WebForm) for a while, but new to ASP.NET MVC. From
I have been working with ASP.NET MVC for a couple of months now and
I am working on an ASP.NET MVC application and using jQuery. I understand from
I'm working on an ASP.Net MVC 3 project, which needs localized error messages from
I'm working on an ASP.NET MVC 3 application. I primarily come from a ASP.NET
I am working on an ASP.NET MVC project. The data access in through a
I am working with ASP.NET MVC. I need local time depending on user IP
I've just started working with ASP.NET MVC now that it's in beta. In my
When working with asp.net MVC 3, the default website which is installed from the

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.