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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:20:09+00:00 2026-06-04T14:20:09+00:00

I am trying to understand how the database access model works in asp.net mvc,

  • 0

I am trying to understand how the database access model works in asp.net mvc, some examples has the work in the controller but other has examples in the model.

I want to know how to do it using ado.net, the best practices is use a class in the model layer and try my database access there?

all examples are with EF and LINQ, I want to know the best way to do it using ado.net.

the database access is in model or controller?

  • 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-04T14:20:12+00:00Added an answer on June 4, 2026 at 2:20 pm

    Here is an architectural design to consider:

    1. The Views and Controllers are in the MVC website.
    2. The Models are in a separate project.
    3. The data access code is in a third project called DataAccess or
      Repository.

    The website has references to the Models and DataAccess projects. The DataAccess project also has a reference to the Models project.

    This way, the data access code is separate. It is easier to find and maintain. It could be used in another solution. You could even swap it out for a completely different data access layer — say, switching from Linq to SQL to Entity Framework or classic ADO.Net.

    By keeping the Models in a separate project, they can be referenced by both the website and the data access layer. In addition, the Models project could be used in other solutions, just like the loosely-coupled data access layer.

    Separating the layers this way makes it easier to add testing, too. That would be made easier if the data access layer/repository utilizes interfaces and dependency injection.

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

Sidebar

Related Questions

i am self-studying asp.net and was trying some small projects to help understand the
I'm trying to understand how to design a database that can accommodate an indeterminate
Trying to understand the options for will_paginate's paginate method: :page — REQUIRED, but defaults
I understand this has been discussed before but since this post in late 2010
We have recently had to do some work with an OpenEdge database that a
I have an ASP.NET 2.0 web application. It uses System.Data.OracleClient, Version=2.0.0.0 to access an
I am trying to make my app rotation friendly, but I am having some
I'm trying to upload a database into my webhost's server. It has got support
Please be gentle, I'm a newb to this IoC/MVC thing but I am trying.
I am trying to reduce the amount of database access by providing a in

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.