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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:05:35+00:00 2026-05-13T07:05:35+00:00

i have a data access layer that abstracts the rest of the application away

  • 0

i have a data access layer that abstracts the rest of the application away from the persistence technology. Right now the implementation is SQL server but that might change. Anyway, i find this main data access class getting larger and large as my tables grow (about 40 tables now). The interface of this data access layer is any question you might want to get data on

 public interface IOrderRepository
 {
       Customer[] GetCustomerForOrder(int orderID);
       Order[] GetCustomerOrders(int customerID);
       Product[] GetProductList(int orderID);
       Order[] GetallCustomersOrders(int customerID);
       etc . . .
 }

the implementation behind this is basic SQL stored procs running the appropriate queries and returning the results in typed collections

this will keep growing and growing. Its pretty maintainable as there isn’t a real break of single responsibility but the class is now over 2000 lines of code.

so the question is, due to sure class size (and no real conceptual coupling), should this get broken down and if so on what dimension or level of abstraction.

  • 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-05-13T07:05:36+00:00Added an answer on May 13, 2026 at 7:05 am

    Absolutely refactor. 2000 lines is huge.

    I’d start by breaking it down by return type. Thus you would get one class for accessing Products, one for Orders, one for Customers and so on.

    For each of the class, the set of columns selected should probably the same, so that could get refactored into a single variable/method as the extracting of the SQL values into objects.

    Also the actual call to the Stored Procedure, including logging and exception handling could and should go into a separate class.

    BTW you do have a violation of single responsibility. According to your description your class right now has the following responsibilities:

    • create sql statements for querying a table (about 40 times)
    • hydrating the results of calls to stored procedures
    • calling stored procedures

    And I am assuming
    – logging
    – exception handling

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

Sidebar

Related Questions

I have a data access layer (DAL) that is written in ASP.NET 3.5 and
I have created a Data Access Layer using .NET. Everywhere that I update a
In our data access layer at work we have this standard implementation where the
I'm designing a Data Access layer for an C#/ASP.net application and I have a
Let's say I'm building a data access layer for an application. Typically I have
I've been working on an application that has no discernable data access layer, so
I have a data access layer that has separate classes for each table in
I have a method in my data access layer that performs mapping. The method
I've implemented a data access layer that populates generic entities from a datareader using
I have a Data Access Layer library that I would like to make portable.

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.