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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:06:00+00:00 2026-05-30T11:06:00+00:00

The following definition from wikipedia explains what is the Data Access Layer in a

  • 0

The following definition from wikipedia explains what is the Data Access Layer in a multi-layered application.

A data access layer (DAL) is a layer of a computer program which
provides simplified access to data stored in persistent storage of
some kind, such as a database.

The persistent storage could also consist of one or more files, but the upper layers do not know how I organized the information in the files. Suppose we have an application that uses a configuration file, such as app.config or web.config: in the app.config file there may be the values ​​of some parameters (for example the maximum size of a cache), so these values must be loaded during application startup. Moreover, if the application allows the editing of these parameters through a UI, then the app.config file should be updated. Are these operation part of the DAL?

  • 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-30T11:06:02+00:00Added an answer on May 30, 2026 at 11:06 am

    A bit of separation of concerns is sensible, as it allows you to test pieces individually easier since they are not burdened with dealing with specific concerns such as where and how configuration is stored and retrieved.

    It may be sensible to create a model of the configuration data you need and accept this model as a dependency (via a constructor), or if the configuration data is simple enough, it can just be a few properties on the component itself.

    In the case of creating a model to transmit configuration information, you’ll have an easier time using that object in the part of your application that allows the user to interact with configurable values. UI to configure your app is a separate feature in itself.

    Here’s a silly example.

    public class Settings
    {
        public string SettingOne { get; set; }
    
        public bool SettingTwo { get; set; }
    
    }
    
    public class DAL
    {
        public Settings Settings { get; private set; }
    
        public DAL(Settings settings)
        {
    
        }
    }
    

    So, if you use unit tests, you can test just the DAL by giving it the settings you want, without bothering with the piece that manages your settings (below is a frivolous example of an NUnit test).

    [Test]
    public void Should_do_something_important()
    {
        // Arrange
        var dal = new DAL(new Settings { SettingOne = "whatever", SettingTwo = true });
    
        // Act
        var result = dal.DoSomethingImportant();
    
        // Assert
        Assert.That(result, Is.Not.Null);
    }
    

    Now, in your application, you can have a separate component that manages settings (if you so choose… maybe your settings are really quite simple, and this extra step is unnecessary; it’s up to you), which you can fully test on its own.

    public class SettingsManager
    {
         public Settings ReadSettings(string path)
         {
             // read from the store
    
         }
    
         public void WriteSettings(Settings settings, string path)
         {
            // write settings to the store
         }
    
    }
    

    And another frivolous test:

    [Test]
    public void Should_write_settings_to_store()
    {
        // Arrange
        var manager = new SettingsManager();
    
        // Act
        var settings = new Settings { SettingOne = "value", SettingsTwo = true };
        manager.WriteSettings(settings, @"C:\settings\settings.config");
    
        // Assert
        Assert.That(File.Exists(@"C:\settings\settings.config", Is.True));
    }
    

    Now in your application, you can do something like this to bring them together:

    protected DAL DAL { get; private set; }
    
    public void Init()
    {
          var manager = new SettingsManager();
    
          DAL = new DAL(manager.ReadSettings(@"C:\settings\settings.config"));
    }
    

    The benefit with going this route is now your DAL and your management of settings are uncoupled. You can now build and test the two pieces independently. Let your DAL focus on DAL stuff, and settings manager focus on managing settings.

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

Sidebar

Related Questions

Consider the following definition from a DTD: <!ELEMENT application (calculator)?> <!ATTLIST application uri CDATA
From the following definition of a Distributor: The Distributor is a database instance that
From the following definition: A distributed database is a collection of multiple, logically interrelated
Situation is following. I have shared library, which contains class definition - QueueClass :
I've been asked to make an ETL-style application that transfers information from one data
I have the following tzinfo concrete subclass definition: from datetime import datetime, timedelta, tzinfo
I derived a class from MembershipProvider in System.Web.Security with the following definition: public class
Below is a function from JQueryTools and I have never seen the following definition
Assuming following definition: /// <summary> /// Replaces each occurrence of sPattern in sInput with
I have a WebForm that contains the following definition for the FCKeditor: <FCKeditorV2:FCKeditor ID=txtBody

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.