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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:39:47+00:00 2026-06-15T22:39:47+00:00

Currently my application’s UI layer is coupled to my DAL dll. Dal is initialized

  • 0

Currently my application’s UI layer is coupled to my DAL dll. Dal is initialized like this:

//Initialize Data Access for AS400
Dal = JDE8Dal.Instance;
Dal.conString = Properties.Settings.Default.conAS400;

DAL is desinged as singleton. I thought that forcing the application to have one instance is a good idea.

DAL:

public class JDE8Dal
    {
        public string conString { get; set; }
        private static readonly JDE8Dal _instance = new JDE8Dal();
        private JDE8Dal()
        {
        }
        public static JDE8Dal Instance
        {
            get { return _instance; }
        }
        // Methods
    }

My BLL will look something like this:

namespace YLA.Barcode
{
    public static class YlaBarcodeUtil
    {
        public static string LotStripZeroes(string str)
        {
            var ret = str;
            if (str.Trim().StartsWith("00"))
            {
                ret = YlaGeneralUtilities.StripLeadingNumofChars(str, 2);
            }
            return ret;
        }
    }

public class BarcodeBLL
{
    //DAL INIT HERE?
}
}

Now that i need to build more applications i need to move into a 3 layer architecture and start reading on DDD.

1) How to move the DAL handling in BLL? Just add the initialization in my BLL section?

2) Should i keep my DAL design as singleton or not?

  • 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-15T22:39:48+00:00Added an answer on June 15, 2026 at 10:39 pm

    You should use the Inversion of Control pattern to reduce the dependency between your layers. In your case I would use a constructor injection as the data context is required by your class:

    public class BarcodeBLL
    {
        private JDE8Dal _context;
    
        public BarcodeBLL(JDE8Dal context)
        {
            _context = context;
        }
    }
    

    Data context should be short lived objects. If you’re developing a web application you should instantiate one data context per request. I would also recommend using an ORM (Entity Framework / NHibernate).

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

Sidebar

Related Questions

Currently my application caches models in memcache like this: memcache.set(somekey, aModel) But Nicks' post
Our application currently looks like this: [ Navigation Controller] [ Content ] [ Tab
Our application currently stores bunch of configuraton & application specific data to files on
My Application currently serves requests for data, and can order the data to the
My application currently needs to upload a large amount of data to a database
This is the structure of my application currently: UIWindow UIViewController (Root View Controller) UINavigationController
My application currently installs documents and other files to two folders using lines like:
I'm introducing a DAO layer in our application currently working on SQL Server because
Currently our application exporting large data to office 2003 xml spreadsheet format in server.
Currently my application is 32-bit. This means that all tables running on SQL Server

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.